public function onRequestException(ResponseExceptionEvent $event)
 {
     $event->stopPropagation();
     $event->setResponse(new Response($event->getException()->getMessage()));
     $event->getKernel()->shutdown();
     $this->responseEvent = $event;
 }
 public function exception(ResponseExceptionEvent $event)
 {
     $event->stopPropagation();
     $event->getKernel()->shutdown();
     $this->writeException($event->getException(), new Output());
     exit(1);
 }
 /**
  * Handle exception.
  *
  * @param ResponseExceptionEvent $event
  */
 public final function handle(ResponseExceptionEvent $event)
 {
     $event->stopPropagation();
     $this->report($event->getException());
     $event->setResponse($this->render($event->getException()));
 }
 /**
  * Send exception.
  *
  * @param Exception $e
  */
 private function sendException(Exception $e)
 {
     $evt = new ResponseExceptionEvent($this, $this->request);
     $evt->setException($e);
     $this->fireEvent(KernelEvents::EXCEPTION, $evt);
     if (false !== $this->booted) {
         if (!$evt->hasResponse()) {
             throw new RuntimeException(sprintf('There are no response found. Did you forgot add a return statement?'));
         }
         $evt->getResponse()->send();
     }
 }