From f28351094acdda34f49bdb4c0574f5a8f771b971 Mon Sep 17 00:00:00 2001 From: Dominik Prabucki Date: Wed, 7 Aug 2024 08:30:57 +0200 Subject: [PATCH] fix test's warnings --- app/Exceptions/ErrorHandlingConfig.php | 19 +++++++++++++++++++ bootstrap/app.php | 13 +++---------- 2 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 app/Exceptions/ErrorHandlingConfig.php diff --git a/app/Exceptions/ErrorHandlingConfig.php b/app/Exceptions/ErrorHandlingConfig.php new file mode 100644 index 00000000..3cf39885 --- /dev/null +++ b/app/Exceptions/ErrorHandlingConfig.php @@ -0,0 +1,19 @@ +withRouting( web: __DIR__ . "/../routes/web.php", @@ -28,11 +21,11 @@ }) ->withExceptions(function (Exceptions $exceptions): void { $exceptions->respond(function (Response $response, Throwable $exception, Request $request): Response { - if (!app()->environment(["local", "testing"]) && in_array($response->getStatusCode(), HANDLED_ERROR_CODES, true)) { + if (!app()->environment(["local", "testing"]) && in_array($response->getStatusCode(), ErrorHandlingConfig::HANDLED_ERROR_CODES, true)) { return Inertia::render("Errors/Error", ["status" => $response->getStatusCode()]) ->toResponse($request) ->setStatusCode($response->getStatusCode()); - } elseif ($response->getStatusCode() === HTTP_SESSION_EXPIRED) { + } elseif ($response->getStatusCode() === ErrorHandlingConfig::HTTP_SESSION_EXPIRED) { return back()->with([ "message" => "The page expired, please try again.", ]);