@@ -253,7 +253,7 @@ configuration option to point to it:
253
253
254
254
# config/packages/framework.yaml
255
255
framework :
256
- error_controller : App\Controller\ErrorController::showAction
256
+ error_controller : App\Controller\ErrorController::show
257
257
258
258
.. code-block :: xml
259
259
@@ -265,7 +265,7 @@ configuration option to point to it:
265
265
https://symfony.com/schema/dic/services/services-1.0.xsd" >
266
266
267
267
<framework : config >
268
- <framework : error-controller >App\Controller\ErrorController::showAction </framework : error-controller >
268
+ <framework : error-controller >App\Controller\ErrorController::show </framework : error-controller >
269
269
</framework : config >
270
270
271
271
</container >
@@ -274,7 +274,7 @@ configuration option to point to it:
274
274
275
275
// config/packages/framework.php
276
276
$container->loadFromExtension('framework', [
277
- 'error_controller' => 'App\Controller\ErrorController::showAction ',
277
+ 'error_controller' => 'App\Controller\ErrorController::show ',
278
278
// ...
279
279
]);
280
280
@@ -284,70 +284,12 @@ the request that will be dispatched to your controller. In addition, your contro
284
284
will be passed two parameters:
285
285
286
286
``exception ``
287
- A :class: `\\ Symfony\\ Component\\ ErrorHandler\\ Exception\\ FlattenException `
288
- instance created from the exception being handled.
287
+ The original :class: `Throwable ` instance exception being handled.
289
288
290
289
``logger ``
291
290
A :class: `\\ Symfony\\ Component\\ HttpKernel\\ Log\\ DebugLoggerInterface `
292
291
instance which may be ``null `` in some circumstances.
293
292
294
- Instead of creating a new exception controller from scratch you can also extend
295
- the default :class: `Symfony\\ Bundle\\ TwigBundle\\ Controller\\ ExceptionController `.
296
- In that case, you might want to override one or both of the ``showAction() `` and
297
- ``findTemplate() `` methods. The latter one locates the template to be used.
298
-
299
- .. note ::
300
-
301
- In case of extending the
302
- :class: `Symfony\\ Bundle\\ TwigBundle\\ Controller\\ ExceptionController ` you
303
- may configure a service to pass the Twig environment and the ``debug `` flag
304
- to the constructor.
305
-
306
- .. configuration-block ::
307
-
308
- .. code-block :: yaml
309
-
310
- # config/services.yaml
311
- services :
312
- _defaults :
313
- # ... be sure autowiring is enabled
314
- autowire : true
315
- # ...
316
-
317
- App\Controller\CustomExceptionController :
318
- public : true
319
- arguments :
320
- $debug : ' %kernel.debug%'
321
-
322
- .. code-block :: xml
323
-
324
- <!-- config/services.xml -->
325
- <?xml version =" 1.0" encoding =" UTF-8" ?>
326
- <container xmlns =" http://symfony.com/schema/dic/services"
327
- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
328
- xsi : schemaLocation =" http://symfony.com/schema/dic/services
329
- https://symfony.com/schema/dic/services/services-1.0.xsd" >
330
-
331
- <services >
332
- <!-- ... be sure autowiring is enabled -->
333
- <defaults autowire =" true" />
334
- <!-- ... -->
335
-
336
- <service id =" App\Controller\CustomExceptionController" public =" true" >
337
- <argument key =" $debug" >%kernel.debug%</argument >
338
- </service >
339
- </services >
340
-
341
- </container >
342
-
343
- .. code-block :: php
344
-
345
- // config/services.php
346
- use App\Controller\CustomExceptionController;
347
-
348
- $container->autowire(CustomExceptionController::class)
349
- ->setArgument('$debug', '%kernel.debug%');
350
-
351
293
.. tip ::
352
294
353
295
The :ref: `error page preview <testing-error-pages >` also works for
0 commit comments