8000 Merge branch '3.4' into 4.1 · symfony/symfony-docs@c39cc36 · GitHub
[go: up one dir, main page]

Skip to content

Commit c39cc36

Browse files
committed
Merge branch '3.4' into 4.1
* 3.4: Fix console error event
2 parents 3d66d31 + 980dd85 commit c39cc36

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

components/console/events.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,17 @@ event listeners, the ``ConsoleEvents::ERROR`` event is dispatched. A listener
9494
can wrap or change the exception or do anything useful before the exception is
9595
thrown by the application.
9696

97+
The ``ConsoleEvents::ERROR`` Event
98+
----------------------------------
99+
100+
**Typical Purposes**: Handle exceptions thrown during the execution of a
101+
command.
102+
103+
Whenever an exception is thrown by a command, including those triggered from
104+
event listeners, the ``ConsoleEvents::ERROR`` event is dispatched. A listener
105+
can wrap or change the exception or do anything useful before the exception is
106+
thrown by the application.
107+
97108
Listeners receive a
98109
:class:`Symfony\\Component\\Console\\Event\\ConsoleErrorEvent` event::
99110

@@ -111,7 +122,7 @@ Listeners receive a
111122
$exitCode = $event->getExitCode();
112123

113124
// changes the exception to another one
114-
$event->setException(new \LogicException('Caught exception', $exitCode, $event->getError()));
125+
$event->setError(new \LogicException('Caught exception', $exitCode, $event->getError()));
115126
});
116127

117128
The ``ConsoleEvents::TERMINATE`` Event

0 commit comments

Comments
 (0)
0