#93 - wip
This commit is contained in:
@@ -5,6 +5,8 @@ declare(strict_types=1);
|
||||
namespace Toby\Architecture;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler;
|
||||
use Inertia\Inertia;
|
||||
use Throwable;
|
||||
|
||||
class ExceptionHandler extends Handler
|
||||
{
|
||||
@@ -13,4 +15,21 @@ class ExceptionHandler extends Handler
|
||||
"password",
|
||||
"password_confirmation",
|
||||
];
|
||||
|
||||
public function render($request, Throwable $e)
|
||||
{
|
||||
$response = parent::render($request, $e);
|
||||
|
||||
if (!app()->environment(['local', 'testing']) && in_array($response->status(), [500, 503, 404, 403])) {
|
||||
return Inertia::render('Error', ['status' => $response->status()])
|
||||
->toResponse($request)
|
||||
->setStatusCode($response->status());
|
||||
} else if ($response->status() === 419) {
|
||||
return back()->with([
|
||||
'message' => 'The page expired, please try again.',
|
||||
]);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user