Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e36ea50

Browse filesBrowse files
committed
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 ------- 6167ce4 [Notifier] Fix error handling for Free mobile
2 parents 2235be0 + 6167ce4 commit e36ea50
Copy full SHA for e36ea50

File tree

Expand file treeCollapse file tree

1 file changed

+7
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-2
lines changed

‎src/Symfony/Component/Notifier/Bridge/FreeMobile/FreeMobileTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/FreeMobile/FreeMobileTransport.php
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,14 @@ protected function doSend(MessageInterface $message): void
6666
]);
6767

6868
if (200 !== $response->getStatusCode()) {
69-
$error = $response->toArray(false);
69+
$errors = [
70+
400 => 'Missing required parameter or wrongly formatted message.',
71+
402 => 'Too many messages have been sent too fast.',
72+
403 => 'Service not enabled or wrong credentials.',
73+
500 => 'Server error, please try again later.',
74+
];
7075

71-
throw new TransportException(sprintf('Unable to send the SMS: "%s" (see "%s").', $error['message'], $error['more_info']), $response);
76+
throw new TransportException(sprintf('Unable to send the SMS: error %d: ', $response->getStatusCode()).($errors[$response->getStatusCode()] ?? ''), $response);
7277
}
7378
}
7479
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.