diff options
author | Marvin Borner | 2018-07-07 16:50:10 +0200 |
---|---|---|
committer | Marvin Borner | 2018-07-07 16:50:10 +0200 |
commit | 8ba38dcf7fbd96a6f13639057e045eba114e2f39 (patch) | |
tree | 74d15cf2de45c38cbdbe8484ef2d5bcb2f92a08a /app/Exceptions | |
parent | 87484e7221503f2eeeedd4a7a405eddc57ead95d (diff) |
Even better http error messages
Diffstat (limited to 'app/Exceptions')
-rw-r--r-- | app/Exceptions/Handler.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 217b6e1..0e458d9 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -50,8 +50,15 @@ class Handler extends ExceptionHandler { if ($exception instanceof HttpException) { $statusCode = $exception->getStatusCode(); + switch ($statusCode) { + case '404': + $codeMessage = 'Page could not be found'; + } + $errorMessage = $exception->getMessage() == '' ? ($codeMessage ? $codeMessage : 'An unknown error occurred.') : $exception->getMessage(); + + return response(View::make('errors.http', [ - 'ErrorMessage' => $exception->getMessage() == '' ? 'An unknown error occurred.' : $exception->getMessage(), + 'ErrorMessage' => $errorMessage, 'ErrorCode' => $statusCode ]), $statusCode); } |