From e8bc393802dca5f2358872692afe612c20061e8e Mon Sep 17 00:00:00 2001 From: Fabrice Gangler <fabrice.gangler@adullact.org> Date: Mon, 15 Jul 2024 11:02:49 +0200 Subject: [PATCH] feat: customize error pages see: https://symfony.com/doc/current/controller/error_pages.html --- .../TwigBundle/Exception/error.html.twig | 20 +++++++++++++++++++ .../TwigBundle/Exception/error403.html.twig | 16 +++++++++++++++ .../TwigBundle/Exception/error404.html.twig | 15 ++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 webapp/templates/bundles/TwigBundle/Exception/error.html.twig create mode 100644 webapp/templates/bundles/TwigBundle/Exception/error403.html.twig create mode 100644 webapp/templates/bundles/TwigBundle/Exception/error404.html.twig diff --git a/webapp/templates/bundles/TwigBundle/Exception/error.html.twig b/webapp/templates/bundles/TwigBundle/Exception/error.html.twig new file mode 100644 index 0000000..1f5265d --- /dev/null +++ b/webapp/templates/bundles/TwigBundle/Exception/error.html.twig @@ -0,0 +1,20 @@ +{% extends 'app_base.html.twig' %} +{% block title %} Error {{ status_code }} - {{ status_text }}{% endblock %} + +{% block body %} + <h1>Error {{ status_code }} {{ status_text }}</h1> + + <div class="col-md-8 alert alert-danger" role="alert"> + <h2>Oops, an error occurred</h2> + <p> The server returned a <em>"{{ status_code }} {{ status_text }}"</em>. </p> + <p> Something is broken. Please let us know what you were doing when + this error occurred. We will fix it as soon as possible. + Sorry for any inconvenience caused. + </p> + </div> + <p> + <a href="{{ path('app_home') }}">Return to the homepage</a>. + </p> + +{% endblock %} + diff --git a/webapp/templates/bundles/TwigBundle/Exception/error403.html.twig b/webapp/templates/bundles/TwigBundle/Exception/error403.html.twig new file mode 100644 index 0000000..dd0dfef --- /dev/null +++ b/webapp/templates/bundles/TwigBundle/Exception/error403.html.twig @@ -0,0 +1,16 @@ +{% extends 'app_base.html.twig' %} +{% block title %} Error {{ status_code }} - {{ status_text }}{% endblock %} + +{% block body %} + <h1>Error {{ status_code }} {{ status_text }}</h1> + + <div class="col-md-8 alert alert-danger" role="alert"> + <p> You are not authorized to display this page. </p> + </div> + <p> + <a href="{{ path('app_home') }}">Return to the homepage</a>. + </p> + +{% endblock %} + + diff --git a/webapp/templates/bundles/TwigBundle/Exception/error404.html.twig b/webapp/templates/bundles/TwigBundle/Exception/error404.html.twig new file mode 100644 index 0000000..3d89c4b --- /dev/null +++ b/webapp/templates/bundles/TwigBundle/Exception/error404.html.twig @@ -0,0 +1,15 @@ +{% extends 'app_base.html.twig' %} +{% block title %} Error 404 - Page not found {% endblock %} + +{% block body %} + <h1>Error 404</h1> + + <div class="col-md-8 alert alert-danger" role="alert"> + <h2>Page not found</h2> + <p> The requested page couldn't be located. </p> + <p> Checkout for any URL + misspelling or <a href="{{ path('app_home') }}">return to the homepage</a>. + </p> + </div> + +{% endblock %} -- GitLab