8000 bug #52095 [Notifier][Sendinblue] Handle error responses without a me… · symfony/symfony@754e482 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 754e482

Browse files
bug #52095 [Notifier][Sendinblue] Handle error responses without a message key (stof)
This PR was merged into the 5.4 branch. Discussion ---------- [Notifier][Sendinblue] Handle error responses without a message key | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT During their outage yesterday where the endpoint returned errors with status code 500, there was no `message` key in the json response. This avoids a notice when the key does not exist. Instead, it uses the full response content, as done when the decoding fails. Commits ------- 8ae8993 Handle Sendinblue error responses without a message key
2 parents bccdccc + 8ae8993 commit 754e482

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Component/Mailer/Bridge/Sendinblue/Transport/SendinblueApiTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $e
6565
}
6666

6767
if (201 !== $statusCode) {
68-
throw new HttpTransportException('Unable to send an email: '.$result['message'].sprintf(' (code %d).', $statusCode), $response);
68+
throw new HttpTransportException('Unable to send an email: '.($result['message'] ?? $response->getContent(false)).sprintf(' (code %d).', $statusCode), $response);
6969
}
7070

7171
$sentMessage->setMessageId($result['messageId']);

src/Symfony/Component/Notifier/Bridge/Sendinblue/SendinblueTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected function doSend(MessageInterface $message): SentMessage
7575
if (201 !== $statusCode) {
7676
$error = $response->toArray(false);
7777

78-
throw new TransportException('Unable to send the SMS: '.$error['message'], $response);
78+
throw new TransportException('Unable to send the SMS: '.($error['message'] ?? $response->getContent(false)), $response);
7979
}
8080

8181
$success = $response->toArray(false);

0 commit comments

Comments
 (0)
0