Skip to content

Include template name in render error SourceLocation - #345

Open
ezralicodes wants to merge 7 commits into
pantor:mainfrom
ezralicodes:fix/error-template-name-249
Open

ezralicodes wants to merge 7 commits into
pantor:mainfrom
ezralicodes:fix/error-template-name-249

Conversation

@ezralicodes

Copy link
Copy Markdown

Summary

When an error is raised while rendering an {% include %} / {% extends %} template, the line/column in SourceLocation refer to that nested file, but the message did not say which template it was.

This stores the template path/key on Template and SourceLocation, and includes it in the exception text when present:

[inja.exception.render_error] (at 1:10 in header.html) variable 'name' not found

Anonymous string templates keep the previous (at line:col) format.

Fixes #249

Test plan

  • Added include-files / error reports included template name regression
  • Existing renderer/parser throw-string checks still match (empty filename → unchanged message)

Signed-off-by: ezralicodes <ezralicodes@users.noreply.github.com>
Signed-off-by: ezralicodes <ezralicodes@users.noreply.github.com>
Signed-off-by: ezralicodes <ezralicodes@users.noreply.github.com>
Signed-off-by: ezralicodes <ezralicodes@users.noreply.github.com>
Signed-off-by: ezralicodes <ezralicodes@users.noreply.github.com>
Signed-off-by: ezralicodes <ezralicodes@users.noreply.github.com>
Signed-off-by: ezralicodes <ezralicodes@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

Error message should state which template raised exception

1 participant