-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Mailer] Fix Error Handling for OhMySMTP Bridge #46603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
It looks like you unchecked the "Allow edits from maintainer" box. That is fine, but please note that if you have multiple commits, you'll need to squash your commits into one before this can be merged. Or, you can check the "Allow edits from maintainers" box and the maintainer can squash for you. Cheers! Carsonbot |
@@ -67,7 +67,7 @@ protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $e | |||
} | |||
|
|||
if (200 !== $statusCode) { | |||
throw new HttpTransportException('Unable to send an email: '.$result['Message'].sprintf(' (code %d).', $result['ErrorCode']), $response); | |||
throw new HttpTransportException('Unable to send an email: '.json_encode($result), $response); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go with $response->getContent(false)
instead
side note: please squash when pushing the change - or allow us to push on your fork if you prefer we squash on our side 🙏 |
Thanks! That should cover it? :-) |
@@ -67,7 +67,7 @@ protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $e | |||
} | |||
|
|||
if (200 !== $statusCode) { | |||
throw new HttpTransportException('Unable to send an email: '.$result['Message'].sprintf(' (code %d).', $result['ErrorCode']), $response); | |||
throw new HttpTransportException('Unable to send an email: '.$response->getContent(false), $response); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we figure out all possibilities instead of "just" dumping the content?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, that's the same on line 64, let's do it that way then.
Thank you @paul-oms. |
The OhMySMTP Bridge does not handle errors correctly, and throws up an
Undefined array key "Message"
error when an API error is encountered (e.g. an invalid API key or Internal Server Error). This PR fixes this by showing the full error response.