@@ -29,13 +29,30 @@ control you need:
29
29
which allows complete control over exception handling. For more
30
30
information, see :ref: `kernel-kernel.exception `.
31
31
32
+ The default ``ExceptionController `` will either display an
33
+ *exception * or *error * page, depending on the setting of the ``kernel
34
+ .debug `` flag. While *exception * pages give you a lot of helpful
35
+ information during development, *error * pages are meant to be
36
+ shown to the end-user.
37
+
38
+ .. sidebar :: Testing error pages during development
39
+
40
+ Setting ``kernel.debug `` to ``false `` in order to see your
41
+ error pages during development is impractical as it also stops
42
+ Symfony2 from recompiling your twig templates, among other things.
43
+
44
+ The third-party `webfactory/exceptions-bundle `_ provides a special
45
+ test controller that allows you to display your custom error
46
+ pages for arbitrary HTTP status codes even with ``kernel
47
+ .debug `` set to ``true ``.
48
+
32
49
All of the error templates live inside the TwigBundle. To override the
33
50
templates, simply rely on the standard method for overriding templates that
34
51
live inside a bundle. For more information, see
35
52
:ref: `overriding-bundle-templates `.
36
53
37
- For example, to override the default error template that's shown to the
38
- end-user, create a new template located at
54
+ For example, to override the default error template, create a new
55
+ template located at
39
56
``app/Resources/TwigBundle/views/Exception/error.html.twig ``:
40
57
41
58
.. code-block :: html+jinja
@@ -111,23 +128,4 @@ Symfony uses the following algorithm to determine which template to use:
111
128
``exception.html.twig `` for the standard HTML exception page or
112
129
``exception.json.twig `` for the JSON exception page.
113
130
114
- Testing Error Pages during development
115
- --------------------------------------
116
-
117
- The default exception controller,
118
- ``Symfony\Bundle\TwigBundle\Controller\ExceptionController ``, which is
119
- part of the TwigBundle will show
120
- *exception * pages when you're in ``kernel.debug `` mode and *error *
121
- pages otherwise. Thus, your end users will typically see the *error *
122
- pages.
123
-
124
- But setting ``kernel.debug `` to ``false `` during development to write
125
- or test your custom error pages is impractical as it stops Symfony2 from
126
- recompiling the Twig templates, among other things.
127
-
128
- To help you with that, `webfactory/exceptions-bundle `_ contains a
129
- simple test controller that you can use to trigger custom exceptions. At
130
- the same time, it will make the `ExceptionController ` display the
131
- corresponding *error * pages also in ``kernel.debug `` mode.
132
-
133
131
.. _`webfactory/exceptions-bundle` : https://github.com/webfactory/exceptions-bundle
0 commit comments