Skip to content

jinja2.exceptions.TemplateSyntaxError.source is empty for included files #457

@keu

Description

@keu

I have tried to make Jinja's error messages better and more useful for template writers.

Catching the jinja2.exceptions.TemplateSyntaxError exception gives me the all information I need:

  • template source, i.e. - filename
  • line number
  • error message
  • template source

But if the error occurs in nested template (included with {% include 'nested.txt' %}), the source is empty.
Is there any reason why this happens?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions