短信网关异常处理
parent
e91ae242d7
commit
557888392c
|
|
@ -6,6 +6,7 @@ use Illuminate\Auth\AuthenticationException;
|
|||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Overtrue\EasySms\Exceptions\NoGatewayAvailableException;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Throwable;
|
||||
|
||||
|
|
@ -64,6 +65,14 @@ class Handler extends ExceptionHandler
|
|||
return new HttpException(404, __(':resource not found', ['resource' => $resource]), $e);
|
||||
});
|
||||
|
||||
$this->reportable(function (NoGatewayAvailableException $e) {
|
||||
foreach ($e->getExceptions() as $exception) {
|
||||
$this->report($exception);
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$this->renderable(function (BizException $e, $request) {
|
||||
if ($this->shouldReturnJson($request, $e)) {
|
||||
return response()->json($this->convertExceptionToArray($e), $e->status);
|
||||
|
|
|
|||
Loading…
Reference in New Issue