Page MenuHomePhabricator

templater: add hint to template parse errors to help locate issues

Authored by ryanmce on Mar 3 2018, 4:49 PM.



Previously, we would print the error name and location, but this isn't as
helpful as we can be. Let's add a hint that shows the location where we
encountered the parse error.

Diff Detail

rHG Mercurial
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ryanmce created this revision.Mar 3 2018, 4:49 PM
durin42 requested changes to this revision.Mar 3 2018, 4:55 PM
durin42 added a subscriber: durin42.

We should add a test about templates that contain newlines - it's probably Hard, so feel free to just not be helpful with newline-containing templates for now?


Nit: could we make this be "^ here" instead of just the caret?

This revision now requires changes to proceed.Mar 3 2018, 4:55 PM
ryanmce updated this revision to Diff 6484.Mar 3 2018, 5:11 PM
pulkit added a subscriber: pulkit.Mar 3 2018, 5:17 PM

I like similar things in rust too. I am +1 on this.

durin42 accepted this revision.Mar 3 2018, 5:42 PM
This revision is now accepted and ready to land.Mar 3 2018, 5:42 PM
This revision was automatically updated to reflect the committed changes.
yuja added a subscriber: yuja.Mar 3 2018, 7:21 PM
yuja added inline comments.

Perhaps this pos + 1 is the reason why the error location is sometimes wrong.
I'll send a follow up.