Skip to content

Commit

Permalink
remove exception class
Browse files Browse the repository at this point in the history
  • Loading branch information
PrabuckiDominik committed Aug 7, 2024
1 parent f283510 commit 6ca1d44
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
19 changes: 0 additions & 19 deletions app/Exceptions/ErrorHandlingConfig.php

This file was deleted.

10 changes: 7 additions & 3 deletions bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

declare(strict_types=1);

use App\Exceptions\ErrorHandlingConfig;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
Expand All @@ -21,11 +20,16 @@
})
->withExceptions(function (Exceptions $exceptions): void {
$exceptions->respond(function (Response $response, Throwable $exception, Request $request): Response {
if (!app()->environment(["local", "testing"]) && in_array($response->getStatusCode(), ErrorHandlingConfig::HANDLED_ERROR_CODES, true)) {
if (!app()->environment(["local", "testing"]) && in_array($response->getStatusCode(), [
Response::HTTP_FORBIDDEN,
Response::HTTP_INTERNAL_SERVER_ERROR,
Response::HTTP_SERVICE_UNAVAILABLE,
Response::HTTP_NOT_FOUND,
], true)) {
return Inertia::render("Errors/Error", ["status" => $response->getStatusCode()])
->toResponse($request)
->setStatusCode($response->getStatusCode());
} elseif ($response->getStatusCode() === ErrorHandlingConfig::HTTP_SESSION_EXPIRED) {
} elseif ($response->getStatusCode() === 419) {
return back()->with([
"message" => "The page expired, please try again.",
]);
Expand Down

0 comments on commit 6ca1d44

Please sign in to comment.