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

Parsing errors are not user-friendly #72

Open
preciselytom opened this issue Nov 1, 2021 · 1 comment
Open

Parsing errors are not user-friendly #72

preciselytom opened this issue Nov 1, 2021 · 1 comment

Comments

@preciselytom
Copy link

Our app allows end users (not developers) to write mathematical expressions. We would like to present errors in a way that the users will understand. Unfortunately, the parser errors are very low-level and not related to the mathematical syntax.

Examples of actual and desired output:

Input:
Actual error:  unexpected EOF while scanning extensions
Desired error: input is empty

Input:         (
Actual error:  unexpected EOF while scanning extensions
Desired error: missing right parenthesis

Input:         )
Actual error:  unexpected ")" while scanning extensions
Desired error: missing left parenthesis

Input:         ()
Actual error:  unexpected ")" while scanning extensions
Desired error: no expression inside parentheses

Input:         1+
Actual error:  unexpected EOF while scanning extensions
Desired error: missing expression to the right of "+"

Input:         +1
Actual error:  unexpected "+" while scanning extensions
Desired error: missing expression to the left of "+"
@generikvault
Copy link
Collaborator

Yes better errors would be great.
It's pretty hard to implement them inside a framework as generell as gval.

If you have a solution thats general enough to work with the generic approach, feel free to make a pull request

Maybe it's easier to make a post check if an error occurs. Run a few RegExp and replace the error message if it matchs the expression?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants