Skip to content

Commit 4d84fba

Browse files
committed
Symfony > 3.3 Console error instead of Exception event support
1 parent 0f22eb6 commit 4d84fba

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/ErrorsBundle/Subscriber/ErrorHandlerSubscriber.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Gamma\ErrorsBundle\Subscriber;
44

5+
use App\Kernel;
56
use Gamma\ErrorsBundle\Debug\ErrorHandler;
67
use Symfony\Component\Console\ConsoleEvents;
78
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
@@ -35,11 +36,18 @@ public function __construct(ErrorHandler $errorHandler)
3536
*/
3637
public static function getSubscribedEvents()
3738
{
38-
return [
39-
KernelEvents::REQUEST => ['onRequest'],
39+
$events = [
40+
KernelEvents::REQUEST => ['onRequest'],
4041
KernelEvents::EXCEPTION => ['onKernelException'],
41-
ConsoleEvents::EXCEPTION => ['onConsoleException'],
4242
];
43+
44+
if (Kernel::VERSION >= '3.3') {
45+
$events[ConsoleEvents::ERROR] = ['onConsoleException'];
46+
} else {
47+
$events[ConsoleEvents::EXCEPTION] = ['onConsoleException'];
48+
}
49+
50+
return $events;
4351
}
4452

4553
/**

0 commit comments

Comments
 (0)