Skip to content

Commit faad683

Browse files
committed
Address most of the comments made by Wouter
1 parent 3842b61 commit faad683

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

cookbook/controller/error_pages.rst

+12-9
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,31 @@ Error pages for the production environment can be customized in different ways
2727
depending on your needs:
2828

2929
#. If you just want to change the contents and styles of the error pages to match
30-
the rest of your application, :ref:`override default error templates <use-default-exception-controller>`.
30+
the rest of your application, :ref:`override default error templates <use-default-exception-controller>`;
3131

3232
#. If you also want to tweak the logic used by Symfony to generate error pages,
33-
:ref:`override the default exception controller <custom-exception-controller>`.
33+
:ref:`override the default exception controller <custom-exception-controller>`;
3434

3535
#. If you need total control of exception handling to execute your own logic
3636
:ref:`use the kernel.exception event <use-kernel-exception-event>`.
3737

3838
.. _use-default-exception-controller:
39+
.. _using-the-default-exceptioncontroller:
3940

4041
Overriding the Default Error Templates
4142
--------------------------------------
4243

43-
By default, when an exception occurs, the ``showAction()`` method of the
44+
By default, the ``showAction()`` method of the
4445
:class:`Symfony\\Bundle\\TwigBundle\\Controller\\ExceptionController` is called
45-
thanks to an event listener configured by the TwigBundle.
46+
whenever an exception occurs, thanks to an event listener configured by the TwigBundle.
4647

4748
Then, the controller selects one of the templates defined in the
4849
``Resources/views/Exception`` directory of the TwigBundle to render the error
4950
page. If you browse that directory (usually located in
5051
``vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle``) you'll find a lot of
51-
templates defined for different types of errors and content formats.
52+
templates defined for different types of errors and content formats
53+
(``error.*.twig`` templates are used in the production environment whereas
54+
``exception.*.twig`` templates are used in the development environment).
5255

5356
.. _cookbook-error-pages-by-status-code:
5457

@@ -96,10 +99,10 @@ store the HTTP status code and message respectively.
9699

97100
.. tip::
98101

99-
If your application defines custom exceptions and they implement the
100-
:class:`Symfony\\Component\\HttpKernel\\Exception\\HttpExceptionInterface`,
101-
the ``status_code`` variable will contain the value returned by the
102-
``getStatusCode()`` method. Otherwise, the ``status_code`` variable will be ``500``.
102+
You can customize the status code by implementing
103+
:class:`Symfony\\Component\\HttpKernel\\Exception\\HttpExceptionInterface`
104+
and its required ``getStatusCode()`` method. Otherwise, the ``status_code``
105+
will default to ``500``.
103106

104107
.. note::
105108

0 commit comments

Comments
 (0)