Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Notifier] Fix error handling for Free mobile #36517

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

Merged
merged 1 commit into from
Apr 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,14 @@ protected function doSend(MessageInterface $message): void
]);

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);
}
}
}