Skip to content

Commit d4bb765

Browse files
APachecoDiSantijaviereguiluz
authored andcommitted
Replace ExceptionListener uses with ErrorListener
1 parent 47f3d57 commit d4bb765

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

create_framework/dependency_injection.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ to it::
2727
$argumentResolver = new HttpKernel\Controller\ArgumentResolver();
2828

2929
$dispatcher = new EventDispatcher();
30-
$dispatcher->addSubscriber(new HttpKernel\EventListener\ExceptionListener(
30+
$dispatcher->addSubscriber(new HttpKernel\EventListener\ErrorListener(
3131
'Calendar\Controller\ErrorController::exception'
3232
));
3333
$dispatcher->addSubscriber(new HttpKernel\EventListener\RouterListener($matcher, $requestStack));
@@ -124,7 +124,7 @@ Create a new file to host the dependency injection container configuration::
124124
$containerBuilder->register('listener.response', HttpKernel\EventListener\ResponseListener::class)
125125
->setArguments(['UTF-8'])
126126
;
127-
$containerBuilder->register('listener.exception', HttpKernel\EventListener\ExceptionListener::class)
127+
$containerBuilder->register('listener.exception', HttpKernel\EventListener\ErrorListener::class)
128128
->setArguments(['Calendar\Controller\ErrorController::exception'])
129129
;
130130
$containerBuilder->register('dispatcher', EventDispatcher\EventDispatcher::class)

create_framework/http_kernel_httpkernel_class.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,22 @@ framework: it matches the incoming request and populates the request
6666
attributes with route parameters.
6767

6868
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
7070
make your error management configurable::
7171

7272
$errorHandler = function (Symfony\Component\ErrorHandler\Exception\FlattenException $exception) {
7373
$msg = 'Something went wrong! ('.$exception->getMessage().')';
7474

7575
return new Response($msg, $exception->getStatusCode());
7676
};
77-
$dispatcher->addSubscriber(new HttpKernel\EventListener\ExceptionListener($errorHandler));
77+
$dispatcher->addSubscriber(new HttpKernel\EventListener\ErrorListener($errorHandler));
7878

79-
``ExceptionListener`` gives you a ``FlattenException`` instance instead of the
79+
``ErrorListener`` gives you a ``FlattenException`` instance instead of the
8080
thrown ``Exception`` or ``Error`` instance to ease exception manipulation and
8181
display. It can take any valid controller as an exception handler, so you can
8282
create an ErrorController class instead of using a Closure::
8383

84-
$listener = new HttpKernel\EventListener\ExceptionListener(
84+
$listener = new HttpKernel\EventListener\ErrorListener(
8585
'Calendar\Controller\ErrorController::exception'
8686
);
8787
$dispatcher->addSubscriber($listener);

0 commit comments

Comments
 (0)