vendor/sentry/sentry-symfony/src/EventListener/ErrorListener.php line 11

Open in your IDE?
  1. <?php
  2. namespace Sentry\SentryBundle\EventListener;
  3. use Symfony\Component\Console\Event\ConsoleErrorEvent;
  4. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  5. use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
  6. final class ErrorListener
  7. {
  8.     public function onKernelException(GetResponseForExceptionEvent $event): void
  9.     {
  10.         \Sentry\captureException($event->getException());
  11.     }
  12.     public function onConsoleError(ConsoleErrorEvent $event): void
  13.     {
  14.         \Sentry\captureException($event->getError());
  15.     }
  16.     /**
  17.      * BC layer for Symfony < 3.3; see https://symfony.com/blog/new-in-symfony-3-3-better-handling-of-command-exceptions
  18.      */
  19.     public function onConsoleException(ConsoleExceptionEvent $event): void
  20.     {
  21.         \Sentry\captureException($event->getException());
  22.     }
  23. }