{#
/**
 * Copyright © 2003-2024 The Galette Team
 *
 * This file is part of Galette (https://galette.eu).
 *
 * Galette is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Galette is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
 */
#}
{% extends 'public_page.html.twig' %}

{% macro render_ex(exception) %}
    <div class="ui segment">
        <h3>{{ _T("Details") }}</h3>
        <p>
            <strong>{{ _T("Type:") }}</strong>
            {{ get_class(exception) }}
        </p>
        <p>
            <strong>{{ _T("Code:") }}</strong>
            {{ exception.getCode() }}
        </p>
        <p>
            <strong>{{ _T("Message:") }}</strong>
            {{ exception.getMessage() }}
        </p>
        {% if constant('class', exception) != 'Galette\\Exception\\PHPStartupException' %}
        <p>
            <strong>{{ _T("File:") }}</strong>
            {{ exception.getFile() }}
        </p>
        <p>
            <strong>{{ _T("Line:") }}</strong>
            {{ exception.getLine() }}
        </p>
        {% endif %}
    </div>
    {% if constant('class', exception) != 'Galette\\Exception\\PHPStartupException' %}
    <div class="ui segment error-trace">
        <h3>{{ _T("Trace") }}</h3>
        <pre>{{ exception.getTraceAsString() }}</pre>
    </div>
    {% endif %}
    {% if exception.getPrevious() %}
        {{ _self.render_ex(exception.getPrevious()) }}
    {% endif %}
{% endmacro %}

{% block content %}
    <div class="ui red message">
        <h2 class="ui center aligned header">{{ _T("Application error") }}</h2>
    </div>

    {% if login.isLogged() and login.isAdmin() or callstatic('\\Galette\\Core\\Galette', 'isDebugEnabled') %}
        {{ _self.render_ex(exception) }}
    {% endif %}
{% endblock %}
