From 2f8af69a98fc85c0b22adc03aec53095505d4744 Mon Sep 17 00:00:00 2001 From: dlorek Date: Fri, 9 Jul 2021 17:46:15 +0200 Subject: [PATCH] fixed checking whether message is sent --- SmsapiTransport.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SmsapiTransport.php b/SmsapiTransport.php index 79df322..976baa4 100644 --- a/SmsapiTransport.php +++ b/SmsapiTransport.php @@ -65,10 +65,10 @@ protected function doSend(MessageInterface $message): SentMessage ], ]); - if (200 !== $response->getStatusCode()) { - $error = $response->toArray(false); + $responseContent = $response->toArray(false); - throw new TransportException(sprintf('Unable to send the SMS: "%s".', $error['message']), $response); + if ((isset($responseContent['error']) && null !== $responseContent['error']) || (200 !== $response->getStatusCode()) ) { + throw new TransportException(sprintf('Unable to send the SMS: "%s".', $responseContent['message']), $response); } return new SentMessage($message, (string) $this);