{% if exception.query %}
{{ exception.__class__.__name__ }}: {{ html_escape(exception) }}
{% else %}
{{ exception.__class__.__name__ }}{% if exception.args %}: {% for arg in exception.args %}{{ html_escape(arg) }}{% endfor %}{% endif %}
{% endif %}
{% for path, lineno, content_path in stack %}
{% if content_path %}
{{ content_path }}
{{ gen_snippet(path, lineno, show_linenos=False) }}
{% else %}
{{ path }}:{{ lineno }}
{{ gen_snippet(path, lineno, show_linenos=True) }}
{% endif %}
{% endfor %}