X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/9e7bcacf8c5615526add66e950407d02ec1ac185..refs/pull/5280/head:/app/Exceptions/PrettyException.php diff --git a/app/Exceptions/PrettyException.php b/app/Exceptions/PrettyException.php index 8ed135de7..606085231 100644 --- a/app/Exceptions/PrettyException.php +++ b/app/Exceptions/PrettyException.php @@ -1,43 +1,59 @@ -getCode() === 0) ? 500 : $this->getCode(); + $code = $this->getStatusCode(); + return response()->view('errors.' . $code, [ - 'message' => $this->getMessage(), + 'message' => $this->getMessage(), 'subtitle' => $this->subtitle, - 'details' => $this->details, + 'details' => $this->details, ], $code); } public function setSubtitle(string $subtitle): self { $this->subtitle = $subtitle; + return $this; } public function setDetails(string $details): self { $this->details = $details; + return $this; } + + /** + * Get the desired HTTP status code for this exception. + */ + public function getStatusCode(): int + { + return ($this->getCode() === 0) ? 500 : $this->getCode(); + } + + /** + * Get the desired HTTP headers for this exception. + */ + public function getHeaders(): array + { + return []; + } }