File tree 2 files changed +6
-6
lines changed 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ to it::
27
27
$argumentResolver = new HttpKernel\Controller\ArgumentResolver();
28
28
29
29
$dispatcher = new EventDispatcher();
30
- $dispatcher->addSubscriber(new HttpKernel\EventListener\ExceptionListener (
30
+ $dispatcher->addSubscriber(new HttpKernel\EventListener\ErrorListener (
31
31
'Calendar\Controller\ErrorController::exception'
32
32
));
33
33
$dispatcher->addSubscriber(new HttpKernel\EventListener\RouterListener($matcher, $requestStack));
@@ -124,7 +124,7 @@ Create a new file to host the dependency injection container configuration::
124
124
$containerBuilder->register('listener.response', HttpKernel\EventListener\ResponseListener::class)
125
125
->setArguments(['UTF-8'])
126
126
;
127
- $containerBuilder->register('listener.exception', HttpKernel\EventListener\ExceptionListener ::class)
127
+ $containerBuilder->register('listener.exception', HttpKernel\EventListener\ErrorListener ::class)
128
128
->setArguments(['Calendar\Controller\ErrorController::exception'])
129
129
;
130
130
$containerBuilder->register('dispatcher', EventDispatcher\EventDispatcher::class)
Original file line number Diff line number Diff line change @@ -66,22 +66,22 @@ framework: it matches the incoming request and populates the request
66
66
attributes with route parameters.
67
67
68
68
Our code is now much more concise and surprisingly more robust and more
69
- powerful than ever. For instance, use the built-in ``ExceptionListener `` to
69
+ powerful than ever. For instance, use the built-in ``ErrorListener `` to
70
70
make your error management configurable::
71
71
72
72
$errorHandler = function (Symfony\Component\ErrorHandler\Exception\FlattenException $exception) {
73
73
$msg = 'Something went wrong! ('.$exception->getMessage().')';
74
74
75
75
return new Response($msg, $exception->getStatusCode());
76
76
};
77
- $dispatcher->addSubscriber(new HttpKernel\EventListener\ExceptionListener ($errorHandler));
77
+ $dispatcher->addSubscriber(new HttpKernel\EventListener\ErrorListener ($errorHandler));
78
78
79
- ``ExceptionListener `` gives you a ``FlattenException `` instance instead of the
79
+ ``ErrorListener `` gives you a ``FlattenException `` instance instead of the
80
80
thrown ``Exception `` or ``Error `` instance to ease exception manipulation and
81
81
display. It can take any valid controller as an exception handler, so you can
82
82
create an ErrorController class instead of using a Closure::
83
83
84
- $listener = new HttpKernel\EventListener\ExceptionListener (
84
+ $listener = new HttpKernel\EventListener\ErrorListener (
85
85
'Calendar\Controller\ErrorController::exception'
86
86
);
87
87
$dispatcher->addSubscriber($listener);
You can’t perform that action at this time.
0 commit comments