/**
* Converts an Exception to a Response.
*
* @param Request $request
* @param FlattenException $exception
* @return Response
*/
public function showAction(Request $request, FlattenException $exception)
{
if (is_subclass_of($exception->getClass(), 'Pagekit\\Kernel\\Exception\\HttpException')) {
$title = $exception->getMessage();
} else {
$title = __('Whoops, looks like something went wrong.');
}
$content = $this->getAndCleanOutputBuffering($request->headers->get('X-Php-Ob-Level', -1));
$response = App::view('system/error.php', compact('title', 'exception', 'content'));
return App::response($response, $exception->getCode(), $exception->getHeaders());
}