Open 304NotModified opened 5 years ago
Another example is here: https://github.com/rexm/Handlebars.Net/issues/301
Related error issue here: https://github.com/rexm/Handlebars.Net/issues/306
PR welcome
Are the row and column numbers tracked after compiling currently? Where could I find them?
They are not. This has been on the roadmap for v2 for a few years and requires a refactoring at every layer in the compiler - no small amount of work, but fairly well understood.
@rexm can I go from Token
to the original source? If not, could I add that? (maybe missing something from the lexer?)
That would be the first step, each token would need to be reversible. In some cases during that stage some meaningless white space is thrown away so that would need to be accounted for.
OK, for error messages the meaningless white space isn't really a problem I guess ;)
That would be the first step, each token would need to be reversible. In some cases during that stage some meaningless white space is thrown away so that would need to be accounted for.
something like this? https://github.com/rexm/Handlebars.Net/pull/316
I mention it because if your goal is reporting the row and column, it may be slightly off based on that.
yes, row and column would be great, but I think that's the hard for now.
So therefor im also fine with printing the value which is error.
e.g.
{{#File}}
could give, {{#File}} is not closed
Luckily the title of this issue is "Please report betters errors " ;)
Just following on from this @304NotModified or @rexm what is the best context that can be easily identified to provide more informative feedback to users. In my case, I have users defining their own templates which are later used in the system to generate HTML for fields. When the template is wrong, I would like to provide as much information as I can to help pinpoint the issue rather than something like "Starting and ending handlebars do not match".
I understand that precision will require significant re-engineering, but am curious what could be done given current architecture.
Example 1
{{#File}}
(mistake, should be{{File}}
gives:
Example 2
{{File}}}
Missing line / column numbers
Example 3
{{#if !File}} {{/if}}
(wrong!
)