/** * Render an ajax exception using Whoops. * * @param \Exception $e * @return \Illuminate\Http\Response */ protected function renderAjaxExceptionWithWhoops($e) { $whoops = new \Whoops\Run(); $jsonHandler = new \Whoops\Handler\JsonResponseHandler(); $jsonHandler->addTraceToOutput(true); $whoops->pushHandler($jsonHandler); return new \Illuminate\Http\Response($whoops->handleException($e), $e->getStatusCode(), $e->getHeaders()); }