vendor/daniel-230/firehouse-interface/src/Services/ExceptionHandlerService.php line 10

Open in your IDE?
  1. <?php
  2. namespace Daniel230\FirehouseInterface\Services;
  3. use Daniel230\FirehouseInterface\Firehouse;
  4. class ExceptionHandlerService
  5. {
  6.     public function onSymfonyException($event)
  7.     {
  8.         
  9.         if (
  10.             class_exists('Symfony\Component\HttpKernel\Event\ExceptionEvent') &&
  11.             $event instanceof \Symfony\Component\HttpKernel\Event\ExceptionEvent
  12.         ) {
  13.             
  14.             $request $event->getRequest();
  15.             $ip $request->getClientIp();
  16.             
  17.             $throwable $event->getThrowable();
  18.             // Convert the Throwable to an Exception if necessary
  19.             if ($throwable instanceof \Throwable) {
  20.                 
  21.                 $throwable = new \Exception($throwable->getMessage(), $throwable->getCode(), $throwable);
  22.                 
  23.             }
  24.             // Report the error using Firehouse
  25.             $firehouse = new Firehouse();
  26.             $firehouse->reportError($throwable, function ($error) use ($ip) {
  27.                 $error->setRequestIp($ip);
  28.             });;
  29.         }
  30.     }
  31. }