X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/2dcc5105ad0b4f7701099b57f89f45de0d0ff8e8..refs/pull/63/head:/app/Exceptions/Handler.php diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index d18a9bd2c..73a316953 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -1,10 +1,14 @@ message); return response()->redirectTo($e->redirectLocation); } + // Handle pretty exceptions which will show a friendly application-fitting page + // Which will include the basic message to point the user roughly to the cause. + if (($e instanceof PrettyException || $e->getPrevious() instanceof PrettyException) && !config('app.debug')) { + $message = ($e instanceof PrettyException) ? $e->getMessage() : $e->getPrevious()->getMessage(); + return response()->view('errors/500', ['message' => $message], 500); + } + return parent::render($request, $e); } }