From 557888392cba083a9068e70d537638c501e0e58d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Fri, 31 Dec 2021 20:33:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E7=BD=91=E5=85=B3=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Exceptions/Handler.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 1b5674d7..9f14437d 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -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);