X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/9135a85de4eef32a91c7a3ee0aa405ed454e5a4c..refs/pull/4467/head:/app/Exceptions/Handler.php diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index f2672cf57..36bdf845d 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -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(); } @@ -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);