@@ -14,16 +14,16 @@ a special **exception page** with lots of debug information to help you quickly
1414discover the root problem:
1515
1616.. image :: /images/cookbook/controller/error_pages/exceptions-in-dev-environment.png
17- :alt: A typical exception page in development environment
17+ :alt: A typical exception page in the development environment
1818
1919Since these pages contain a lot of sensitive internal information, Symfony won't
2020display them in the production environment. Instead, it'll show a simple and
2121generic **error page **:
2222
2323.. image :: /images/cookbook/controller/error_pages/errors-in-prod-environment.png
24- :alt: A typical error page in production environment
24+ :alt: A typical error page in the production environment
2525
26- Error pages for production environment can be customized in different ways,
26+ Error pages for the production environment can be customized in different ways
2727depending on your needs:
2828
2929#. If you just want to change the contents and styles of the error pages to match
@@ -53,7 +53,7 @@ templates defined for different types of errors and content formats.
5353.. _cookbook-error-pages-by-status-code :
5454
5555The logic followed by the ``ExceptionController `` to pick one of the available
56- templates is based on the HTTP status code and request format:
56+ templates is based on the HTTP status code and the request format:
5757
5858#. Look for a template for the given format and status code (like ``error404.json.twig ``
5959 or ``error500.xml.twig ``);
@@ -65,6 +65,8 @@ templates is based on the HTTP status code and request format:
6565#. If none of the previous template exist, fall back to the generic HTML template
6666 (``error.html.twig ``).
6767
68+ .. _overriding-or-adding-templates :
69+
6870To override these templates, simply rely on the standard Symfony method for
6971:ref: `overriding templates that live inside a bundle <overriding-bundle-templates >`.
7072For example, to override the 404 error template for HTML pages, create a new
@@ -129,7 +131,7 @@ Testing Error Pages during Development
129131
130132One of the biggest hurdles of testing how do custom error pages look in your
131133application is the fact that Symfony ignores them in the development environment
132- and displays instead the default exception pages.
134+ and displays the default exception pages instead .
133135
134136You may be tempted to set the ``kernel.debug `` parameter to ``false `` to disable
135137the debug mode in the development environment. However, this practice is not
@@ -142,6 +144,7 @@ custom error pages for arbitrary HTTP status codes even when ``kernel.debug`` is
142144set to ``true ``.
143145
144146.. _custom-exception-controller :
147+ .. _replacing-the-default-exceptioncontroller :
145148
146149Overriding the Default ExceptionController
147150------------------------------------------
@@ -188,8 +191,8 @@ configuration option to point to it:
188191 ));
189192
190193 The :class: `Symfony\\ Component\\ HttpKernel\\ EventListener\\ ExceptionListener `
191- class used by TwigBundle as a listener of the ``kernel.exception `` event creates
192- the Request that will be dispatched to your controller. In addition, your controller
194+ class used by the TwigBundle as a listener of the ``kernel.exception `` event creates
195+ the request that will be dispatched to your controller. In addition, your controller
193196will be passed two parameters:
194197
195198``exception ``
@@ -215,13 +218,11 @@ class catches it and dispatches a ``kernel.exception`` event. This gives you the
215218power to convert the exception into a ``Response `` in a few different ways.
216219
217220Working with this event is actually much more powerful than what has been explained
218- before but also requires a thorough understanding of Symfony internals. Suppose
221+ before, but also requires a thorough understanding of Symfony internals. Suppose
219222that your code throws specialized exceptions with a particular meaning to your
220223application domain.
221224
222- If you extend the default ``ExceptionListener ``, all you can get is the HTTP
223- status code and message and display a nice-looking error page. However,
224- :doc: `writing your own event listener </cookbook/service_container/event_listener >`
225+ :doc: `Writing your own event listener </cookbook/service_container/event_listener >`
225226for the ``kernel.exception `` event allows you to have a closer look at the exception
226227and take different actions depending on it. Those actions might include logging
227228the exception, redirecting the user to another page or rendering specialized
0 commit comments