Last active
February 21, 2016 17:09
-
-
Save jbenner-radham/a30682a40ff1cf27a103 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| /** | |
| * Render an exception into a JSON HTTP response. | |
| * | |
| * @param \Exception $e | |
| * @return \Illuminate\Http\Response | |
| */ | |
| public static function renderJson(Exception $e) | |
| { | |
| $whoops = new \Whoops\Run; | |
| $whoops->pushHandler(new \Whoops\Handler\JsonResponseHandler); | |
| return new \Illuminate\Http\Response( | |
| $whoops->handleException($e), | |
| $e->getStatusCode(), | |
| $e->getHeaders() | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment