From: Raphaƫl Gertz Date: Wed, 11 Dec 2019 04:39:11 +0000 (+0100) Subject: Add error controller X-Git-Url: https://git.rapsys.eu/airbundle/commitdiff_plain/75d1b506489d9709b7f136942f470fc40603d467?ds=inline Add error controller --- diff --git a/Controller/ErrorController.php b/Controller/ErrorController.php new file mode 100644 index 0000000..eb53209 --- /dev/null +++ b/Controller/ErrorController.php @@ -0,0 +1,40 @@ +getStatusCode().' '.$this->translator->trans($exception->getStatusText()); + + //Set title + $title = $section.' - '.$this->translator->trans($this->config['site']['title']); + + //Set the message + $message = $exception->getMessage(); + + //Set the trace + $trace = $exception->getAsString(); + + //Render template + return $this->render( + '@RapsysAir/error.html.twig', + ['title' => $title, 'section' => $section, 'message' => $message, 'trace' => $trace]+$this->context + ); + } +} diff --git a/Resources/views/error.html.twig b/Resources/views/error.html.twig new file mode 100644 index 0000000..8dd4a69 --- /dev/null +++ b/Resources/views/error.html.twig @@ -0,0 +1,8 @@ +{% extends '@RapsysAir/body.html.twig' %} +{% block content %} +
+

{{ section }}

+

{% if message %}{{ message }}{% else %}{% trans %}Error{% endtrans %}{% endif %}

+ {% if app.environment == 'dev' and trace is defined %}
{{ trace }}
{% endif %} +
+{% endblock %}