bug #36517 [Notifier] Fix error handling for Free mobile (fabpot)
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Notifier] Fix error handling for Free mobile
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| 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
Looks like the error handling code for Free mobile is a copy/paste from Twilio.
/cc @noniagriconomie
Commits
-------
6167ce4961
[Notifier] Fix error handling for Free mobile
This commit is contained in:
commit
e36ea501a7
@ -66,9 +66,14 @@ final class FreeMobileTransport extends AbstractTransport
|
||||
]);
|
||||
|
||||
if (200 !== $response->getStatusCode()) {
|
||||
$error = $response->toArray(false);
|
||||
$errors = [
|
||||
400 => 'Missing required parameter or wrongly formatted message.',
|
||||
402 => 'Too many messages have been sent too fast.',
|
||||
403 => 'Service not enabled or wrong credentials.',
|
||||
500 => 'Server error, please try again later.',
|
||||
];
|
||||
|
||||
throw new TransportException(sprintf('Unable to send the SMS: "%s" (see "%s").', $error['message'], $error['more_info']), $response);
|
||||
throw new TransportException(sprintf('Unable to send the SMS: error %d: ', $response->getStatusCode()).($errors[$response->getStatusCode()] ?? ''), $response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user