Skip to content

Instantly share code, notes, and snippets.

@mostafa6765
Created June 6, 2017 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mostafa6765/97ca32fc98c442d59ee98314992bfa68 to your computer and use it in GitHub Desktop.
Save mostafa6765/97ca32fc98c442d59ee98314992bfa68 to your computer and use it in GitHub Desktop.
// composer require filp/whoops
/**
* Create a Symfony response for the given exception.
*
* @param \Exception $e
* @return mixed
*/
protected function convertExceptionToResponse(Exception $e)
{
if (config('app.debug')) {
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
return response()->make(
$whoops->handleException($e),
method_exists($e, 'getStatusCode') ? $e->getStatusCode() : 500,
method_exists($e, 'getHeaders') ? $e->getHeaders() : []
);
}
return parent::convertExceptionToResponse($e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment