-
Notifications
You must be signed in to change notification settings - Fork 459
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
Fixed exception type in BrokerConnection::SendAsync, #5091
Fixed exception type in BrokerConnection::SendAsync, #5091
Conversation
…l be retried if no mqttclient exists
@@ -166,7 +168,7 @@ public async Task DisconnectAsync() | |||
|
|||
public async Task<bool> SendAsync(string topic, byte[] payload, bool retain = false) | |||
{ | |||
var client = this.mqttClient.Expect(() => new Exception("No mqtt-bridge connector instance found to send messages.")); | |||
var client = this.mqttClient.Expect(() => new IOException("No mqtt-bridge connector instance found to send messages.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IOException is typically used for file I/O.. so it seems a little odd here. Can we use a custom exception here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch..
Suggest changing the exception thrown to some custom exception..
so operation will be retried if no mqttclient exists. The problem occurred when EdgeHub was shutting down but a message was being sent upstream. As the protocol head was stopped, that cleared the mqttclient client, so the send operation in SendAsync() threw an 'Exception' instance, which was not retriable by CloudEndpoint, so it just skipped the message.
so operation will be retried if no mqttclient exists. The problem occurred when EdgeHub was shutting down but a message was being sent upstream. As the protocol head was stopped, that cleared the mqttclient client, so the send operation in SendAsync() threw an 'Exception' instance, which was not retriable by CloudEndpoint, so it just skipped the message.
so operation will be retried if no mqttclient exists. The problem occurred when EdgeHub was shutting down but a message was being sent upstream. As the protocol head was stopped, that cleared the mqttclient client, so the send operation in SendAsync() threw an 'Exception' instance, which was not retriable by CloudEndpoint, so it just skipped the message.
so operation will be retried if no mqttclient exists.
The problem occurred when EdgeHub was shutting down but a message was being sent upstream. As the protocol head was stopped, that cleared the mqttclient client, so the send operation in SendAsync() threw an 'Exception' instance, which was not retriable by CloudEndpoint, so it just skipped the message.