/** * Render the given HttpException. * * @param \Symfony\Component\HttpKernel\Exception\HttpException $e * @return \Symfony\Component\HttpFoundation\Response */ protected function renderHttpException(HttpException $e) { $status = $e->getStatusCode(); if (view()->exists("errors.{$status}")) { return response()->view("errors.{$status}", ['message' => $e->getMessage()], $status); } return parent::renderHttpException($e); }
protected function renderHttpException(HttpException $exc) { if (\Request::ajax()) { /** @var HttpException $exc */ return $this->convertHttpExceptionToJsonResponse($exc); } else { return parent::renderHttpException($exc); } }
/** * @param \Symfony\Component\HttpKernel\Exception\HttpException $e * @return \Symfony\Component\HttpFoundation\Response */ protected function renderHttpException(HttpException $e) : Response { if (!request()->ajax() && !request()->wantsJson()) { return parent::renderHttpException($e); } $code = $e->getStatusCode(); $message = $this->getHttpMessage($code); return response()->json(["code" => $code, "message" => $message], $code, $e->getHeaders()); }
protected function renderHttpException(HttpException $e) { $status = $e->getStatusCode(); if (view()->exists($this->pathErrors . $status)) { return response()->view($this->pathErrors . $status, ['exception' => $e], $status, $e->getHeaders()); } else { return parent::renderHttpException($e); } }