-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Notifier] [DX] UnsupportedMessageTypeException for notifier transports #39365
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
07c4b6c
to
38157fc
Compare
Can you check the failed tests? |
38157fc
to
774f6f8
Compare
Yes will do 👍
I thought that, thanks! Any preference for the signature and shall we use |
6809c42
to
312920d
Compare
Tests fixed, the lat one is unrelated ❗ fabbot.io failure seems unrelated, and if you want can be fixed in a separate PR: diff -ru src/Symfony/Component/Notifier/Bridge/RocketChat/RocketChatTransport.php src/Symfony/Component/Notifier/Bridge/RocketChat/RocketChatTransport.php
--- src/Symfony/Component/Notifier/Bridge/RocketChat/RocketChatTransport.php 2020-12-08 11:06:07.893047631 +0000
+++ src/Symfony/Component/Notifier/Bridge/RocketChat/RocketChatTransport.php 2020-12-08 11:06:09.624988949 +0000
@@ -77,12 +77,12 @@
);
if (200 !== $response->getStatusCode()) {
- throw new TransportException(sprintf('Unable to post the RocketChat message: %s.', $response->getContent(false)), $response);
+ throw new TransportException(sprintf('Unable to post the RocketChat message: "%s".', $response->getContent(false)), $response);
}
$result = $response->toArray(false);
if (!$result['success']) {
- throw new TransportException(sprintf('Unable to post the RocketChat message: %s.', $result['error']), $response);
+ throw new TransportException(sprintf('Unable to post the RocketChat message: "%s".', $result['error']), $response);
}
}
}
diff -ru src/Symfony/Component/Notifier/Bridge/Telegram/TelegramTransport.php src/Symfony/Component/Notifier/Bridge/Telegram/TelegramTransport.php
--- src/Symfony/Component/Notifier/Bridge/Telegram/TelegramTransport.php 2020-12-08 11:06:08.584024219 +0000
+++ src/Symfony/Component/Notifier/Bridge/Telegram/TelegramTransport.php 2020-12-08 11:06:09.624988949 +0000
@@ -78,7 +78,7 @@
if (200 !== $response->getStatusCode()) {
$result = $response->toArray(false);
- throw new TransportException('Unable to post the Telegram message: '.$result['description'].sprintf(' (code %s).', $result['error_code']), $response);
+ throw new TransportException('Unable to post the Telegram message: '.$result['description'].sprintf(' (code "%s").', $result['error_code']), $response);
}
}
} |
312920d
to
fa39cd6
Compare
7cab59b
to
70c3093
Compare
src/Symfony/Component/Notifier/Transport/TransportInterface.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Notifier/Transport/TransportInterface.php
Outdated
Show resolved
Hide resolved
f40a051
to
cf1d352
Compare
Thank you @OskarStark. |
I want to streamline the experience, creating new notifier transports. Maybe such exceptions fit well, as we are planing to get more and more transports and don't want to "pollute" the transports itself with repeatable code.
Please let me know if you are open to have such exceptions as I would like to introduce more of them for unsupported options for example and if this should be considered a new feature or it should be applied against
5.1
?I am not sure about the signature and the name of the new
UnsupportedMessageTypeException
.Cheers