Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Commit 29b229b

Browse files
author
Jirka Koutny
committed
Exceptions thrown in console are now logged to exceptions_directory
1 parent b5fee94 commit 29b229b

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

KernelExceptionListener.php

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Kutny\TracyBundle;
44

55
use Exception;
6+
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
67
use Symfony\Component\HttpFoundation\Response;
78
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
89
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
@@ -24,6 +25,13 @@ public function onKernelException(GetResponseForExceptionEvent $event)
2425
}
2526
}
2627

28+
public function onConsoleException(ConsoleExceptionEvent $event)
29+
{
30+
$exception = $event->getException();
31+
32+
Debugger::log($exception, Debugger::ERROR);
33+
}
34+
2735
private function isNotFoundException(Exception $exception)
2836
{
2937
return $exception instanceOf NotFoundHttpException;

Resources/config/services.xml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<services>
88
<service id="kutny_tracy_kernel_exception_listener" class="Kutny\TracyBundle\KernelExceptionListener">
99
<tag name="kernel.event_listener" event="kernel.exception" method="onKernelException"/>
10+
<tag name="kernel.event_listener" event="console.exception" method="onConsoleException"/>
1011
</service>
1112
</services>
1213
</container>

0 commit comments

Comments
 (0)