Exemplo n.º 1
0
 /**
  * Renders the exception panel for the given token.
  *
  * @param string $token The profiler token
  *
  * @return Response A Response instance
  */
 public function showAction($token)
 {
     $this->profiler->disable();
     $exception = $this->profiler->loadProfile($token)->getCollector('exception')->getException();
     $template = $this->getTemplate();
     if (!$this->twig->getLoader()->exists($template)) {
         $handler = new ExceptionHandler();
         return new Response($handler->getContent($exception));
     }
     $code = $exception->getStatusCode();
     return new Response($this->twig->render($template, array('status_code' => $code, 'status_text' => Response::$statusTexts[$code], 'exception' => $exception, 'logger' => null, 'currentContent' => '')));
 }
Exemplo n.º 2
0
 /**
  * Renders the exception panel for the given token.
  *
  * @param string $token The profiler token
  *
  * @return Response A Response instance
  */
 public function showAction($token)
 {
     if (null === $this->profiler) {
         throw new NotFoundHttpException('The profiler must be enabled.');
     }
     $this->profiler->disable();
     $exception = $this->profiler->loadProfile($token)->getCollector('exception')->getException();
     $template = $this->getTemplate();
     if (!$this->twig->getLoader()->exists($template)) {
         $handler = new ExceptionHandler();
         return new Response($handler->getContent($exception), 200, array('Content-Type' => 'text/html'));
     }
     $code = $exception->getStatusCode();
     return new Response($this->twig->render($template, array('status_code' => $code, 'status_text' => Response::$statusTexts[$code], 'exception' => $exception, 'logger' => null, 'currentContent' => '')), 200, array('Content-Type' => 'text/html'));
 }