diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/ExceptionController.php index cf035df74c..6877c2d752 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/ExceptionController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/ExceptionController.php @@ -46,8 +46,15 @@ class ExceptionController extends ContainerAware $exception->setStatusCode($exception->getCode()); } - $response = $this->container->get('templating')->renderResponse( - 'FrameworkBundle:Exception:'.($this->container->get('kernel')->isDebug() ? 'exception.php' : 'error.php'), + $templating = $this->container->get('templating'); + $template = 'FrameworkBundle:Exception:'.($this->container->get('kernel')->isDebug() ? 'exception.php' : 'error.php'); + + if (!$templating->exists($template)) { + $this->container->get('request')->setRequestFormat('html'); + } + + $response = $templating->renderResponse( + $template, array( 'exception' => $exception, 'logger' => $logger,