File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony WebpackEncoreBundle package.
5
+ * (c) Fabien Potencier <[email protected] >
6
+ * For the full copyright and license information, please view the LICENSE
7
+ * file that was distributed with this source code.
8
+ */
9
+
10
+ namespace Symfony \WebpackEncoreBundle \EventListener ;
11
+
12
+ use Symfony \Component \HttpKernel \Event \GetResponseForExceptionEvent ;
13
+ use Symfony \WebpackEncoreBundle \Asset \EntrypointLookup ;
14
+ use Twig_Error_Runtime ;
15
+
16
+ class ExceptionListener
17
+ {
18
+ private $ entrypointLookup ;
19
+
20
+ public function __construct (EntrypointLookup $ entrypointLookup )
21
+ {
22
+ $ this ->entrypointLookup = $ entrypointLookup ;
23
+ }
24
+
25
+ public function onKernelException (GetResponseForExceptionEvent $ event )
26
+ {
27
+ $ exception = $ event ->getException ();
28
+
29
+ // Reset the entrypointLookup list of previously returned entries, as Twig_Error_Runtime will initialise a sub-request
30
+ if ($ exception instanceof Twig_Error_Runtime) {
31
+ $ this ->entrypointLookup ->reset ();
32
+ }
33
+ }
34
+ }
Original file line number Diff line number Diff line change 11
11
<argument /> <!-- entrypoints.json path -->
12
12
</service >
13
13
14
+ <service id =" webpack_encore.exceptionlistener" class =" Symfony\WebpackEncoreBundle\EventListener\ExceptionListener" >
15
+ <argument type =" service" id =" webpack_encore.entrypoint_lookup" />
16
+ <tag name =" kernel.event_listener" event =" kernel.request" />
17
+ </service >
18
+
14
19
<service id =" webpack_encore.tag_renderer" class =" Symfony\WebpackEncoreBundle\Asset\TagRenderer" >
15
20
<argument type =" service" id =" webpack_encore.entrypoint_lookup" />
16
21
<argument type =" service" id =" assets.packages" />
You can’t perform that action at this time.
0 commit comments