-
Notifications
You must be signed in to change notification settings - Fork 201
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
Informative error messages: Add line numbers #10
Comments
That's true, the current error messages are really a drawback of this library. I think line numbers are a good start, so I'll have a look at this later 👍 |
Hi, better error messages would be great! But also would be great to do more checks before calling Json library. For example when eval_expression() is trying to get non-existing values via following command
Json library asserted in this code:
Unfortunately, such assertion isn't possible to catch via Exception handler and will cause the application crash (and when assertion is disabled via NDEBUG macro, assert will be executed from STL). Fix for such issue is very simple. Instead of using operator [], you can use function value which allows you to pass default value.
After that you will not get assert and also your next row will work correctly:
If you're interested I can create another PR. |
The latest commit already uses |
Perfect. I already updated it. I wasn't sure if you're interested in PRs so I'm really grateful you merged. Now I don't do that manually on every new version ;-). Thanks for good work! |
This is now implemented for parser errors. |
With the latest commit, this is now implemented for render erros as well. There are some minor issues with included templates, but please open a seperate issue for that. Thanks! |
Hi @pantor , thanks for the great library!
I am trying it for a ~100 lines template, and I am experiencing errors such as:
or
Do you think there is a way to enrich this error with some information that would help to debug the problem, for example the line number in the original template file? Thanks in advance.
The text was updated successfully, but these errors were encountered: