8000 bug #52096 [Notifier] [Brevo] Handle error responses without a messag… · symfony/brevo-mailer@6d216cc · GitHub
[go: up one dir, main page]

Skip to content

Commit 6d216cc

Browse files
bug #52096 [Notifier] [Brevo] Handle error responses without a message key (stof)
This PR was merged into the 6.4 branch. Discussion ---------- [Notifier] [Brevo] Handle error responses without a message key | Q | A | ------------- | --- | Branch? | 6.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. This is the same change than symfony/symfony#52095 but for the new Brevo bridge Commits ------- 517ceaea03 Handle Brevo error responses without a message key
2 parents e762fe9 + 5724a2c commit 6d216cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Transport/BrevoApiTransport.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']);

0 commit comments

Comments
 (0)
0