]> BookStack Code Mirror - bookstack/blobdiff - app/Exceptions/Handler.php
Fixed OIDC Logout
[bookstack] / app / Exceptions / Handler.php
index 9667944d4a4e330fe9621b9d042061f679653478..36bdf845d64d8905e930ab04385ff184f195a267 100644 (file)
@@ -9,7 +9,7 @@ use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
 use Illuminate\Http\JsonResponse;
 use Illuminate\Http\Request;
 use Illuminate\Validation\ValidationException;
-use Symfony\Component\HttpKernel\Exception\HttpException;
+use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
 use Throwable;
 
 class Handler extends ExceptionHandler
@@ -82,7 +82,7 @@ class Handler extends ExceptionHandler
         $code = 500;
         $headers = [];
 
-        if ($e instanceof HttpException) {
+        if ($e instanceof HttpExceptionInterface) {
             $code = $e->getStatusCode();
             $headers = $e->getHeaders();
         }
@@ -98,14 +98,11 @@ class Handler extends ExceptionHandler
         ];
 
         if ($e instanceof ValidationException) {
+            $responseData['error']['message'] = 'The given data was invalid.';
             $responseData['error']['validation'] = $e->errors();
             $code = $e->status;
         }
 
-        if (method_exists($e, 'getStatus')) {
-            $code = $e->getStatus();
-        }
-
         $responseData['error']['code'] = $code;
 
         return new JsonResponse($responseData, $code, $headers);