diff --git a/src/Symfony/Component/Debug/ExceptionHandler.php b/src/Symfony/Component/Debug/ExceptionHandler.php index 027b66c05217..399eb4a64b20 100644 --- a/src/Symfony/Component/Debug/ExceptionHandler.php +++ b/src/Symfony/Component/Debug/ExceptionHandler.php @@ -177,7 +177,7 @@ private function failSafeHandle(\Exception $exception) * This method uses plain PHP functions like header() and echo to output * the response. * - * @param \Exception|FlattenException $exception An \Exception instance + * @param \Exception|FlattenException $exception An \Exception or FlattenException instance */ public function sendPhpResponse($exception) { @@ -199,7 +199,7 @@ public function sendPhpResponse($exception) /** * Creates the error Response associated with the given Exception. * - * @param \Exception|FlattenException $exception An \Exception instance + * @param \Exception|FlattenException $exception An \Exception or FlattenException instance * * @return Response A Response instance */ @@ -209,7 +209,23 @@ public function createResponse($exception) $exception = FlattenException::create($exception); } - return Response::create($this->decorate($this->getContent($exception), $this->getStylesheet($exception)), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset); + return Response::create($this->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset); + } + + /** + * Gets the full HTML content associated with the given exception. + * + * @param \Exception|FlattenException $exception An \Exception or FlattenException instance + * + * @return string The HTML content as a string + */ + public function getHtml($exception) + { + if (!$exception instanceof FlattenException) { + $exception = FlattenException::create($exception); + } + + return $this->decorate($this->getContent($exception), $this->getStylesheet($exception)); } /**