From 20f03952392a9b32f86a5faa0aaa6f3aa138f5a4 Mon Sep 17 00:00:00 2001 From: overtrue Date: Thu, 3 May 2018 20:39:16 +0800 Subject: [PATCH] Fix exception handle. #90 --- src/Messenger.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Messenger.php b/src/Messenger.php index 88bf84d..4d58f6e 100644 --- a/src/Messenger.php +++ b/src/Messenger.php @@ -12,7 +12,6 @@ namespace Overtrue\EasySms; use Overtrue\EasySms\Contracts\MessageInterface; -use Overtrue\EasySms\Exceptions\GatewayErrorException; use Overtrue\EasySms\Exceptions\NoGatewayAvailableException; use Overtrue\EasySms\Support\Config; @@ -78,13 +77,16 @@ public function send($to, $message, array $gateways = []) $isSuccessful = true; break; - } catch (GatewayErrorException $e) { + } catch (\Throwable $e) { + $results[$gateway] = [ + 'status' => self::STATUS_FAILURE, + 'exception' => $e, + ]; + } catch (\Exception $e) { $results[$gateway] = [ 'status' => self::STATUS_FAILURE, 'exception' => $e, ]; - - continue; } }