minor #36170 [Mailer] Use %d instead of %s for error code in error messages (fabpot)
This PR was merged into the 4.4 branch.
Discussion
----------
[Mailer] Use %d instead of %s for error code in error messages
| Q | A
| ------------- | ---
| Branch? | 4.4 <!-- see below -->
| Bug fix? | no
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | n/a <!-- prefix each issue number with "Fix #", if any -->
| License | MIT
| Doc PR | n/a
Commits
-------
9c3951ed69
[Mailer] Use %d instead of %s for error code in error messages
This commit is contained in:
commit
cd1761151c
@ -65,7 +65,7 @@ class SesApiTransport extends AbstractApiTransport
|
|||||||
|
|
||||||
$result = new \SimpleXMLElement($response->getContent(false));
|
$result = new \SimpleXMLElement($response->getContent(false));
|
||||||
if (200 !== $response->getStatusCode()) {
|
if (200 !== $response->getStatusCode()) {
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $result->Error->Message, $result->Error->Code), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', $result->Error->Message, $result->Error->Code), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
$property = $payload['Action'].'Result';
|
$property = $payload['Action'].'Result';
|
||||||
|
@ -65,7 +65,7 @@ class SesHttpTransport extends AbstractHttpTransport
|
|||||||
|
|
||||||
$result = new \SimpleXMLElement($response->getContent(false));
|
$result = new \SimpleXMLElement($response->getContent(false));
|
||||||
if (200 !== $response->getStatusCode()) {
|
if (200 !== $response->getStatusCode()) {
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $result->Error->Message, $result->Error->Code), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', $result->Error->Message, $result->Error->Code), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
$message->setMessageId($result->SendRawEmailResult->MessageId);
|
$message->setMessageId($result->SendRawEmailResult->MessageId);
|
||||||
|
@ -51,10 +51,10 @@ class MandrillApiTransport extends AbstractApiTransport
|
|||||||
$result = $response->toArray(false);
|
$result = $response->toArray(false);
|
||||||
if (200 !== $response->getStatusCode()) {
|
if (200 !== $response->getStatusCode()) {
|
||||||
if ('error' === ($result['status'] ?? false)) {
|
if ('error' === ($result['status'] ?? false)) {
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $result['message'], $result['code']), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', $result['message'], $result['code']), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email (code %s).', $result['code']), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email (code %d).', $result['code']), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
$firstRecipient = reset($result);
|
$firstRecipient = reset($result);
|
||||||
|
@ -58,10 +58,10 @@ class MandrillHttpTransport extends AbstractHttpTransport
|
|||||||
$result = $response->toArray(false);
|
$result = $response->toArray(false);
|
||||||
if (200 !== $response->getStatusCode()) {
|
if (200 !== $response->getStatusCode()) {
|
||||||
if ('error' === ($result['status'] ?? false)) {
|
if ('error' === ($result['status'] ?? false)) {
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $result['message'], $result['code']), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', $result['message'], $result['code']), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email (code %s).', $result['code']), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email (code %d).', $result['code']), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
$message->setMessageId($result[0]['_id']);
|
$message->setMessageId($result[0]['_id']);
|
||||||
|
@ -65,10 +65,10 @@ class MailgunApiTransport extends AbstractApiTransport
|
|||||||
$result = $response->toArray(false);
|
$result = $response->toArray(false);
|
||||||
if (200 !== $response->getStatusCode()) {
|
if (200 !== $response->getStatusCode()) {
|
||||||
if ('application/json' === $response->getHeaders(false)['content-type'][0]) {
|
if ('application/json' === $response->getHeaders(false)['content-type'][0]) {
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $result['message'], $response->getStatusCode()), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', $result['message'], $response->getStatusCode()), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $response->getContent(false), $response->getStatusCode()), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', $response->getContent(false), $response->getStatusCode()), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sentMessage->setMessageId($result['id']);
|
$sentMessage->setMessageId($result['id']);
|
||||||
|
@ -67,10 +67,10 @@ class MailgunHttpTransport extends AbstractHttpTransport
|
|||||||
$result = $response->toArray(false);
|
$result = $response->toArray(false);
|
||||||
if (200 !== $response->getStatusCode()) {
|
if (200 !== $response->getStatusCode()) {
|
||||||
if ('application/json' === $response->getHeaders(false)['content-type'][0]) {
|
if ('application/json' === $response->getHeaders(false)['content-type'][0]) {
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $result['message'], $response->getStatusCode()), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', $result['message'], $response->getStatusCode()), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $response->getContent(false), $response->getStatusCode()), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', $response->getContent(false), $response->getStatusCode()), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
$message->setMessageId($result['id']);
|
$message->setMessageId($result['id']);
|
||||||
|
@ -54,7 +54,7 @@ class PostmarkApiTransport extends AbstractApiTransport
|
|||||||
|
|
||||||
$result = $response->toArray(false);
|
$result = $response->toArray(false);
|
||||||
if (200 !== $response->getStatusCode()) {
|
if (200 !== $response->getStatusCode()) {
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $result['Message'], $result['ErrorCode']), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', $result['Message'], $result['ErrorCode']), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sentMessage->setMessageId($result['MessageID']);
|
$sentMessage->setMessageId($result['MessageID']);
|
||||||
|
@ -53,7 +53,7 @@ class SendgridApiTransport extends AbstractApiTransport
|
|||||||
if (202 !== $response->getStatusCode()) {
|
if (202 !== $response->getStatusCode()) {
|
||||||
$errors = $response->toArray(false);
|
$errors = $response->toArray(false);
|
||||||
|
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', implode('; ', array_column($errors['errors'], 'message')), $response->getStatusCode()), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', implode('; ', array_column($errors['errors'], 'message')), $response->getStatusCode()), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sentMessage->setMessageId($response->getHeaders(false)['x-message-id'][0]);
|
$sentMessage->setMessageId($response->getHeaders(false)['x-message-id'][0]);
|
||||||
|
Reference in New Issue
Block a user