Exceptions
- exception
jinja2.
UndefinedError
(message=None) - Raised if a template tries to operate on
Undefined
.
- exception
jinja2.
TemplatesNotFound
(names=(), message=None) - Like
TemplateNotFound
but raised if multiple templatesare selected. This is a subclass ofTemplateNotFound
exception, so just catching the base exception will catch both.
Changelog
New in version 2.2.
- exception
jinja2.
TemplateSyntaxError
(message, lineno, name=None, filename=None) Raised to tell the user that there is a problem with the template.
The reason why the filename and error message are bytestrings and notunicode strings is that Python 2.x is not using unicode for exceptionsand tracebacks as well as the compiler. This will change with Python 3.
- exception
jinja2.
TemplateRuntimeError
(message=None) - A generic runtime error in the template engine. Under some situationsJinja may raise this exception.
- exception
jinja2.
TemplateAssertionError
(message, lineno, name=None, filename=None) - Like a template syntax error, but covers cases where something in thetemplate caused an error at compile time that wasn’t necessarily causedby a syntax error. However it’s a direct subclass of
TemplateSyntaxError
and has the same attributes.