{%- import '_macros_site.html' as macros_site with context -%}
{%- macro render_debug_info() %}
{# When accessing static files, there is no identity in g so the can() function would raise an exception. #}
{%- if 'identity' in g %}
{%- call macros_site.render_debug_output() %}
{{ macros_site.render_raw_var('status', status) }}
{{ macros_site.render_raw_var('error', error) }}
{%- if message %}
{{ macros_site.render_raw_var('message', message) }}
{%- endif %}
{%- if exception %}
{{ macros_site.render_raw_var('exception', exception) }}
{{ macros_site.render_raw_var('description', exception.description) }}
{%- endif %}
{%- endcall %}
{%- endif %}
{%- endmacro %}
{%- macro get_message(is_alert=False) %}
{%- if exception and exception.description %}
{{ exception.description | safe }}
{%- elif status == 499 %}
{{ _("The query was canceled.") }}
{%- elif status == 400 %}
{%- if message %}
{{ message | safe }}
{%- else %}
{{ _("It seems you have done something naughty.") }}
{%- endif %}
{%- elif status == 403 %}
{%- if message %}
{{ message | safe }}
{%- else %}
{{ _("It seems you do not have sufficient permissions to access this resource.") }}
{%- endif %}
{%- elif status == 404 %}
{{ _("We have looked hard, really really hard, but what you were looking for is just not there.") }}
{%- elif status == 405 %}
{{ _("You have used HTTP method that is not valid for this URL.") }}
{%- elif status == 410 %}
{{ _("What you were looking for is just not there anymore, it is gone forever.") }}
{%- elif status == 500 %}
{{ _("We are sorry, but something on our side of the line went terribly wrong. Please try again later.") }}
{%- else %}
{%- if message %}
{{ message }}
{%- else %}
{{ _("We are sorry, but something went wrong. Please try again later.") }}
{%- endif %}
{%- endif %}
{%- endmacro %}