Skip to content

Commit

Permalink
Symfony > 3.3 Console error instead of Exception event support
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgenas committed Jul 22, 2018
1 parent 0f22eb6 commit 4d84fba
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/ErrorsBundle/Subscriber/ErrorHandlerSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Gamma\ErrorsBundle\Subscriber;

use App\Kernel;
use Gamma\ErrorsBundle\Debug\ErrorHandler;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
Expand Down Expand Up @@ -35,11 +36,18 @@ public function __construct(ErrorHandler $errorHandler)
*/
public static function getSubscribedEvents()
{
return [
KernelEvents::REQUEST => ['onRequest'],
$events = [
KernelEvents::REQUEST => ['onRequest'],
KernelEvents::EXCEPTION => ['onKernelException'],
ConsoleEvents::EXCEPTION => ['onConsoleException'],
];

if (Kernel::VERSION >= '3.3') {
$events[ConsoleEvents::ERROR] = ['onConsoleException'];
} else {
$events[ConsoleEvents::EXCEPTION] = ['onConsoleException'];
}

return $events;
}

/**
Expand Down

0 comments on commit 4d84fba

Please sign in to comment.