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

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Sentry\SentryBundle\EventListener;
  4. use Sentry\State\HubInterface;
  5. use Symfony\Component\HttpKernel\Event\ExceptionEvent;
  6. /**
  7.  * This listener listens for error events and logs them to Sentry.
  8.  */
  9. final class ErrorListener
  10. {
  11.     /**
  12.      * @var HubInterface The current hub
  13.      */
  14.     private $hub;
  15.     /**
  16.      * Constructor.
  17.      *
  18.      * @param HubInterface $hub The current hub
  19.      */
  20.     public function __construct(HubInterface $hub)
  21.     {
  22.         $this->hub $hub;
  23.     }
  24.     /**
  25.      * Handles an exception that happened while running the application.
  26.      *
  27.      * @param ExceptionEvent $event The event
  28.      */
  29.     public function handleExceptionEvent(ExceptionEvent $event): void
  30.     {
  31.         $this->hub->captureException($event->getThrowable());
  32.     }
  33. }