/** * @param Request $request * @param FlattenException $exception * @param string $format */ public function showAction(Request $request, FlattenException $exception, $format) { $handler = new ExceptionHandler($this->app['debug']); if ($this->app['debug']) { return $handler->createResponse($exception); } $code = $exception->getStatusCode(); $template = $this->resolve($request, $code, $format); if ($template) { $contents = $this->app['twig']->render($template, array('status_code' => $code, 'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '', 'exception' => $exception)); return new Response($contents, $code); } return $handler->createResponse($exception); }
public function onError(GetResponseForExceptionEvent $event) { if (!$this->enabled) { return; } $handler = new DebugExceptionHandler($this->debug); $event->setResponse($handler->createResponse($event->getException())); }
public function testNestedExceptions() { $handler = new ExceptionHandler(true); $response = $handler->createResponse(new \RuntimeException('Foo', null, new \RuntimeException('Bar'))); }
public function onSilexError(GetResponseForErrorEvent $event) { $app = $event->getKernel(); $handler = new DebugExceptionHandler($app['debug']); $event->setResponse($handler->createResponse($event->getException())); }