added import middleware
This commit is contained in:
@ -5,6 +5,7 @@ namespace App\Exceptions;
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Illuminate\Http\Exceptions\ThrottleRequestsException;
|
||||
use Symfony\Component\Debug\Exception\FatalThrowableError;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Throwable;
|
||||
@ -127,6 +128,13 @@ class Handler extends ExceptionHandler
|
||||
return response()->view('errors.500', [], 500);
|
||||
}
|
||||
|
||||
if ($exception instanceof ThrottleRequestsException) {
|
||||
// ajax 500 json feedback
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['error' => $exception->getMessage()], 429);
|
||||
}
|
||||
}
|
||||
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user