From 7abf8789e06a79f809c902188a31d82ee2382203 Mon Sep 17 00:00:00 2001 From: Lucas Yang Date: Tue, 28 May 2024 22:04:53 +0800 Subject: [PATCH] Fix resolve error code with http 419 --- src/Exceptions/Handler.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Exceptions/Handler.php b/src/Exceptions/Handler.php index 7d6481d..ddfc128 100644 --- a/src/Exceptions/Handler.php +++ b/src/Exceptions/Handler.php @@ -59,7 +59,11 @@ public function handle(Request $request, SymfonyResponse $response, Throwable $e return $response; } - $code = $e instanceof HttpExceptionInterface ? $e->getStatusCode() : 500; + if ($e instanceof HttpExceptionInterface) { + $code = $e->getStatusCode(); + } else { + $code = $response->getStatusCode(); + } $messages = $this->resolveMessages($e);