]> BookStack Code Mirror - bookstack/blobdiff - app/Exceptions/Handler.php
Fixed OIDC Logout
[bookstack] / app / Exceptions / Handler.php
index 00122c15ad4b54fb626ec5487d02759dff499b17..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
@@ -79,10 +79,10 @@ class Handler extends ExceptionHandler
      */
     protected function renderApiException(Throwable $e): JsonResponse
     {
-        $code = $e->getCode() === 0 ? 500 : $e->getCode();
+        $code = 500;
         $headers = [];
 
-        if ($e instanceof HttpException) {
+        if ($e instanceof HttpExceptionInterface) {
             $code = $e->getStatusCode();
             $headers = $e->getHeaders();
         }
@@ -103,10 +103,6 @@ class Handler extends ExceptionHandler
             $code = $e->status;
         }
 
-        if (method_exists($e, 'getStatus')) {
-            $code = $e->getStatus();
-        }
-
         $responseData['error']['code'] = $code;
 
         return new JsonResponse($responseData, $code, $headers);