Forked from jacurtis/App\Exceptions\Handler.php
Last active
November 27, 2018 09:10
-
-
Save milanarandjelovic/234bbacb0bf28b6002a9066293c9a40c to your computer and use it in GitHub Desktop.
How to get filp/whoops to work in Laravel 5.2 or 5.3 - Add this code to your `App\Exceptions\Handler.php` file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 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