vendor/overblog/graphql-bundle/src/EventListener/ErrorHandlerListener.php line 23

  1. <?php
  2. declare(strict_types=1);
  3. namespace Overblog\GraphQLBundle\EventListener;
  4. use Overblog\GraphQLBundle\Error\ErrorHandler;
  5. use Overblog\GraphQLBundle\Event\ExecutorResultEvent;
  6. final class ErrorHandlerListener
  7. {
  8.     private ErrorHandler $errorHandler;
  9.     private bool $throwException;
  10.     private bool $debug;
  11.     public function __construct(ErrorHandler $errorHandlerbool $throwException falsebool $debug false)
  12.     {
  13.         $this->errorHandler $errorHandler;
  14.         $this->throwException $throwException;
  15.         $this->debug $debug;
  16.     }
  17.     public function onPostExecutor(ExecutorResultEvent $executorResultEvent): void
  18.     {
  19.         $result $executorResultEvent->getResult();
  20.         $this->errorHandler->handleErrors($result$this->throwException$this->debug);
  21.     }
  22. }