-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Enhance showPosition()
to Accurately Display Error Position by Line Number
#2023
Comments
Can you provide an example on how to reproduce the issue? |
In the methods So when I try to remove them & try to get full error template position I am always getting
|
Makes sense. I updated your issue description. Let me know if that is correct. |
adjusted expected error message. It looks correct to me @jaylinski |
One question: Can we modify methods |
Sadly not, the parsing-logic is part of |
|
In order to allow users to implement custom error handlers, one would have to rewrite the current parser. There are projects that attempt to bring handlebars up-to-date, like https://github.com/nknapp/handlebars-ng. Those are probably a better starting point for such big changes. |
I doesn't mean to rewrite whole parser, just send the whole error message as it is from Handlebar(with out truncate/manipulation). Let's users manipulate it as per their need @jaylinski |
Yes, directly exposing the |
Let's do it then @jaylinski . |
I currently don't have time to implement this. But I'll be willing to review/accept PRs if somebody improves the error-message ( |
Hi @jaylinski and @nknapp, I've attempted this task but I'm struggling to find a starting point. Could you provide some guidance or a brief overview to help me get started? |
Description
Preserve new-lines in templates when showing the position of parsing-errors.
Current behavior
Input
Error
https://handlebarsjs.com/playground.html#format=1¤tExample=%7B%22template%22%3A%22%7B%7B%23if%7D%5Cn%20%20HELLO%5Cn%7B%7B%2Fif%7D%7D%22%2C%22partials%22%3A%5B%5D%2C%22input%22%3A%22%7B%7D%5Cn%22%2C%22output%22%3A%22Yehuda%20KATZ%5Cn%22%2C%22preparationScript%22%3A%22%22%2C%22handlebarsVersion%22%3A%224.7.8%22%7D
Expected behavior
Error
Original issues
@jaylinski can we enhance
showPosition()
??to Ensures that the ----^ indicator accurately reflects the error position on the relevant line, rather than defaulting to the last line:
For more visit: zaach/jison#406
The text was updated successfully, but these errors were encountered: