ModelNotFound exception handled #92
This commit is contained in:
parent
2ee655b9d1
commit
9ec1273141
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Log;
|
||||
use Exception;
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
@ -58,6 +59,11 @@ class Handler extends ExceptionHandler
|
||||
$http_code = $exception->getStatusCode();
|
||||
}
|
||||
|
||||
if($exception instanceof ModelNotFoundException) {
|
||||
$status = 404;
|
||||
$http_code = 404;
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'error' => [
|
||||
'code' => $exception->getCode() ,
|
||||
|
Loading…
Reference in New Issue
Block a user