/**
  * Handle an exception.
  *
  * Calls on prepareWhoopsHandler() to inject additional data tables into
  * the generated payload, and then injects the response with the result
  * of whoops handling the exception.
  *
  * @param \Throwable $exception
  * @param Request $request
  * @param Response $response
  * @return Response
  */
 protected function handleException($exception, Request $request, Response $response)
 {
     // Push the whoops handler if any
     if ($this->whoopsHandler !== null) {
         $this->whoops->pushHandler($this->whoopsHandler);
     }
     // Walk through all handlers
     foreach ($this->whoops->getHandlers() as $handler) {
         // Add fancy data for the PrettyPageHandler
         if ($handler instanceof PrettyPageHandler) {
             $this->prepareWhoopsHandler($request, $handler);
         }
     }
     $response->getBody()->write($this->whoops->handleException($exception));
     return $response;
 }
Exemple #2
0
 /**
  * Returns a listing of handlers.
  *
  * @return \Whoops\Handler\HandlerInterface[]
  */
 public function getHandlers()
 {
     return $this->whoops->getHandlers();
 }