protected function handleException($exception, Request $request, Response $response)
{
// Push the whoops handler if any
if ($this->whoopsHandler !== null) {
$this->whoops->pushHandler($this->whoopsHandler);
}
// Walk through all handlers
foreach ($this->whoops->getHandlers() as $handler) {
// Add fancy data for the PrettyPageHandler
if ($handler instanceof PrettyPageHandler) {
$this->prepareWhoopsHandler($request, $handler);
}
}
$response->getBody()->write($this->whoops->handleException($exception));
return $response;
}