Skip to content

Commit

Permalink
added ExceptionHandler::getHtml() to expose the full HTML of an excep…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
fabpot committed Sep 7, 2015
1 parent ae64324 commit 4d1d277
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/Symfony/Component/Debug/ExceptionHandler.php
Expand Up @@ -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)
{
Expand All @@ -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
*/
Expand All @@ -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));
}

/**
Expand Down

0 comments on commit 4d1d277

Please sign in to comment.