@@ -35,7 +35,7 @@ shown to the end-user.
35
35
36
36
The third-party `WebfactoryExceptionsBundle `_ provides a special
37
37
test controller that allows you to display your custom error
38
- pages for arbitrary HTTP status codes even with
38
+ pages for arbitrary HTTP status codes even with
39
39
``kernel.debug `` set to ``true ``.
40
40
41
41
Override Error Templates
@@ -128,12 +128,25 @@ Symfony uses the following algorithm to determine which template to use:
128
128
Replace the default Exception Controller
129
129
----------------------------------------
130
130
131
- Replace the default exception controller ``twig.controller.exception:showAction ``
132
- with your own controller and handle it however you want (see
133
- :ref: `exception_controller in the Twig reference <config-twig-exception-controller >`).
131
+ If you need a little more flexibility beyond just overriding the template
132
+ (e.g. you need to pass some additional variables into your template),
133
+ then you can override the controller that renders the error page.
134
+
134
135
The default exception controller is registered as a service - the actual
135
136
class is ``Symfony\Bundle\TwigBundle\Controller\ExceptionController ``.
136
137
138
+ To do this, create a new controller class and make it extend Symfony's default
139
+ Symfony\B undle\T wigBundle\C ontroller\E xceptionController class.
140
+
141
+ There are several methods you can override to customize different parts of how
142
+ the error page is rendered. You could ie replace the default exception
143
+ controller ``twig.controller.exception:showAction `` with your own method
144
+ and handle it however you want.
145
+
146
+ To make Symfony use your exception controller instead of the default, set the
147
+ :ref: `twig.exception_controller <config-twig-exception-controller> option
148
+ in app/config/config.yml.
149
+
137
150
.. tip::
138
151
139
152
The customization of exception handling is actually much more powerful
0 commit comments