getMessage(), $e); } if ($e instanceof PrettyPageException && PHP_SAPI != "cli") { echo \View::make('errors.e')->with('code', $e->getCode()) ->with('message', $e->getMessage()) ->render(); exit; } if (config('app.debug')) { foreach ($this->dontReport as $type) { if ($e instanceof $type) { return parent::render($request, $e); } } return $this->renderExceptionWithWhoops($e); } return parent::render($request, $e); } /** * Render an exception using Whoops. * * @param \Exception $e * @return \Illuminate\Http\Response */ protected function renderExceptionWithWhoops(Exception $e) { $whoops = new \Whoops\Run; $handler = ($_SERVER['REQUEST_METHOD'] == "GET") ? new \Whoops\Handler\PrettyPageHandler : new \Whoops\Handler\PlainTextHandler; $whoops->pushHandler($handler); return new \Illuminate\Http\Response( $whoops->handleException($e), $e->getStatusCode(), $e->getHeaders() ); } }