]> BookStack Code Mirror - bookstack/blobdiff - app/Exceptions/Handler.php
Fixed some cross browser flexbox popup issues
[bookstack] / app / Exceptions / Handler.php
index 73a3169531c82c8080d13cb822315b1380ff4618..40dd1ec105d3c150a6579ffef095001f3e5a959a 100644 (file)
@@ -48,15 +48,16 @@ class Handler extends ExceptionHandler
         // Handle notify exceptions which will redirect to the
         // specified location then show a notification message.
         if ($e instanceof NotifyException) {
-            \Session::flash('error', $e->message);
-            return response()->redirectTo($e->redirectLocation);
+            session()->flash('error', $e->message);
+            return redirect($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);
+            $code = ($e->getCode() === 0) ? 500 : $e->getCode();
+            return response()->view('errors/' . $code, ['message' => $message], $code);
         }
 
         return parent::render($request, $e);