Fixed 500 error on form error
This commit is contained in:
@@ -26,6 +26,14 @@ return Application::configure(basePath: dirname(__DIR__))
|
|||||||
})
|
})
|
||||||
->withExceptions(function (Exceptions $exceptions): void {
|
->withExceptions(function (Exceptions $exceptions): void {
|
||||||
$exceptions->render(function(Throwable $e, $request) {
|
$exceptions->render(function(Throwable $e, $request) {
|
||||||
|
if (
|
||||||
|
$e instanceof \Illuminate\Validation\ValidationException ||
|
||||||
|
$e instanceof \Illuminate\Auth\AuthenticationException ||
|
||||||
|
$e instanceof \Illuminate\Auth\Access\AuthorizationException ||
|
||||||
|
$e instanceof \Symfony\Component\HttpKernel\Exception\HttpException
|
||||||
|
) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
$statusCode = method_exists($e, 'getStatusCode') ? $e->getStatusCode() : 500;
|
$statusCode = method_exists($e, 'getStatusCode') ? $e->getStatusCode() : 500;
|
||||||
|
|
||||||
if( app()->environment('production') && $statusCode >= 500 && !$request->expectsJson() ){
|
if( app()->environment('production') && $statusCode >= 500 && !$request->expectsJson() ){
|
||||||
|
|||||||
Reference in New Issue
Block a user