Skip to content

Commit fc89d0e

Browse files
committed
Merge branch '2.7' into 2.8
2 parents 5d6a763 + a6b3a77 commit fc89d0e

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

book/http_cache.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ as `Varnish`_, `Squid in reverse proxy mode`_, and the Symfony reverse proxy.
9393
Types of Caches
9494
~~~~~~~~~~~~~~~
9595

96-
But a gateway cache isn't the only type of cache. In fact, the HTTP cache
97-
headers sent by your application are consumed and interpreted by up to three
98-
different types of caches:
96+
A gateway cache isn't the only type of cache. In fact, the HTTP cache headers
97+
sent by your application are consumed and interpreted by up to three different
98+
types of caches:
9999

100100
* *Browser caches*: Every browser comes with its own local cache that is
101101
mainly useful for when you hit "back" or for images and other assets.

components/console/events.rst

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,36 @@ C/C++ standard.::
8686
}
8787
});
8888

89+
The ``ConsoleEvents::EXCEPTION`` Event
90+
--------------------------------------
91+
92+
**Typical Purposes**: Handle exceptions thrown during the execution of a
93+
command.
94+
95+
Whenever an exception is thrown by a command, the ``ConsoleEvents::EXCEPTION``
96+
event is dispatched. A listener can wrap or change the exception or do
97+
anything useful before the exception is thrown by the application.
98+
99+
Listeners receive a
100+
:class:`Symfony\\Component\\Console\\Event\\ConsoleExceptionEvent` event::
101+
102+
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
103+
use Symfony\Component\Console\ConsoleEvents;
104+
105+
$dispatcher->addListener(ConsoleEvents::EXCEPTION, function (ConsoleExceptionEvent $event) {
106+
$output = $event->getOutput();
107+
108+
$command = $event->getCommand();
109+
110+
$output->writeln(sprintf('Oops, exception thrown while running command <info>%s</info>', $command->getName()));
111+
112+
// get the current exit code (the exception code or the exit code set by a ConsoleEvents::TERMINATE event)
113+
$exitCode = $event->getExitCode();
114+
115+
// change the exception to another one
116+
$event->setException(new \LogicException('Caught exception', $exitCode, $event->getException()));
117+
});
118+
89119
The ``ConsoleEvents::TERMINATE`` Event
90120
--------------------------------------
91121

@@ -124,34 +154,4 @@ Listeners receive a
124154
It is then dispatched just after the ``ConsoleEvents::EXCEPTION`` event.
125155
The exit code received in this case is the exception code.
126156

127-
The ``ConsoleEvents::EXCEPTION`` Event
128-
--------------------------------------
129-
130-
**Typical Purposes**: Handle exceptions thrown during the execution of a
131-
command.
132-
133-
Whenever an exception is thrown by a command, the ``ConsoleEvents::EXCEPTION``
134-
event is dispatched. A listener can wrap or change the exception or do
135-
anything useful before the exception is thrown by the application.
136-
137-
Listeners receive a
138-
:class:`Symfony\\Component\\Console\\Event\\ConsoleExceptionEvent` event::
139-
140-
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
141-
use Symfony\Component\Console\ConsoleEvents;
142-
143-
$dispatcher->addListener(ConsoleEvents::EXCEPTION, function (ConsoleExceptionEvent $event) {
144-
$output = $event->getOutput();
145-
146-
$command = $event->getCommand();
147-
148-
$output->writeln(sprintf('Oops, exception thrown while running command <info>%s</info>', $command->getName()));
149-
150-
// get the current exit code (the exception code or the exit code set by a ConsoleEvents::TERMINATE event)
151-
$exitCode = $event->getExitCode();
152-
153-
// change the exception to another one
154-
$event->setException(new \LogicException('Caught exception', $exitCode, $event->getException()));
155-
});
156-
157157
.. _`reserved exit codes`: http://www.tldp.org/LDP/abs/html/exitcodes.html

0 commit comments

Comments
 (0)