Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error messages when syntax is not recognized #213

Closed
lepapareil opened this issue Jun 21, 2021 · 2 comments · Fixed by #221
Closed

Improve error messages when syntax is not recognized #213

lepapareil opened this issue Jun 21, 2021 · 2 comments · Fixed by #221
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@lepapareil
Copy link
Collaborator

hurl version: 1.2.0

what i get:

error: Parsing section name
  --> test.hurl:3:2
   |
 3 | [asserts]
   |  ^ the section asserts is not valid
   |

what i expect:

error: Parsing section name
  --> test.hurl:3:2
   |
 3 | [asserts]
   |  ^ the section asserts is not valid, did you mean --> [Asserts] ?
   |

I think that at first, when an unknown syntax is found, it is enough to compare it in [[lower]] mode to the list of known syntaxes at the expected position and then propose the correction (this can also happen on countEquals etc...)

@lepapareil lepapareil added the enhancement New feature or request label Jun 21, 2021
@fabricereix
Copy link
Collaborator

We decided to accept only section with the first uppercase letter so that hurl files look more similar/uniform.
But yes, in this case, we can indeed be more helpful in the error message

@fabricereix fabricereix linked a pull request Jun 28, 2021 that will close this issue
@fabricereix
Copy link
Collaborator

We can also make suggestion for HTTP methods.
for example:

error: Parsing Method
  --> tests_error_parser/method.hurl:1:1
   |
 1 | GeT http://localhost:8000/hello
   | ^ The HTTP method is not valid. Did you mean GET?

@fabricereix fabricereix changed the title improve error messages when syntax is not recognized Improve error messages when syntax is not recognized Sep 2, 2021
@lepapareil lepapareil added this to the 1.3.0 milestone Oct 12, 2021
@lepapareil lepapareil removed the 1.3.0 label Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants