You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a Built-in Exception is raised, the raised Exception should be modified such that it includes the line number of the Template Line violating the exception.
This Example will trigger a TypeError.
importjinja2environment=jinja2.Environment()
jinja_template=""" {%- for name in names %} ("HELLO {{name}}!") {%- endfor %}"""template=environment.from_string(jinja_template)
data=template.render(names=None)
print(data)
Ideally, if we could modify the triggered TypeError Exception to add a lineno attribute so that we can capture the lineno to better track the line number that triggered the issue.
importjinja2environment=jinja2.Environment()
jinja_template=""" {%- for name in names %} ("HELLO {{name}}!") {%- endfor %}"""try:
template=environment.from_string(jinja_template)
data=template.render(names=None)
exceptExceptionase:
print(f"Error on Line Number: {e.lineno}")
print(data)
The text was updated successfully, but these errors were encountered:
When a Built-in Exception is raised, the raised Exception should be modified such that it includes the line number of the Template Line violating the exception.
This Example will trigger a TypeError.
Ideally, if we could modify the triggered TypeError Exception to add a lineno attribute so that we can capture the lineno to better track the line number that triggered the issue.
The text was updated successfully, but these errors were encountered: