You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
uPLibrary.Networking.M2Mqtt.Exceptions.MqttClientException was unhandled
Message: An unhandled exception of type 'uPLibrary.Networking.M2Mqtt.Exceptions.MqttClientException' occurred in M2Mqtt.Net.dll
(I was using the NuGet 4.3.0 code for this.) I couldn't catch this exception and handle it, because the true exception does not make it to the user's level. Nor could I find out what the actual exception was.
When I compiled the m2mqtt code from GitHub, I debugged it and found that MqttMsgSubscribe.GetBytes() was throwing a TopicsQosLevelsNotMatch exception:
uPLibrary.Networking.M2Mqtt.Exceptions.MqttClientException occurred
HResult=-2146233088
Message=Exception of type 'uPLibrary.Networking.M2Mqtt.Exceptions.MqttClientException' was thrown.
Source=M2Mqtt.Net
StackTrace:
at uPLibrary.Networking.M2Mqtt.Messages.MqttMsgSubscribe.GetBytes(Byte protocolVersion) in C:\Users\Patrick Gardella\Documents\Visual Studio 2015\Projects\paho.mqtt.m2mqtt\M2Mqtt\Messages\MqttMsgSubscribe.cs:line 187
InnerException:
It is the MqttClient.Send() that ignores the throw exceptions: M2Mqtt.Net.dll!uPLibrary.Networking.M2Mqtt.MqttClient.Send(uPLibrary.Networking.M2Mqtt.Messages.MqttMsgBase msg) Line 1029
Clearly I can avoid this now that I know what was wrong, but it would be good to either log the exception or raise it to the user's level.
Thanks for all your great work on this!
Patrick+
The text was updated successfully, but these errors were encountered:
BUT, I think this really should be considered in the MQTT library, and the library should check for this case and throw an appropriate exception with a helpful message to help the user knowing what is going wrong.
Throwing this general exception make the developer confused about what he/she did wrong.
I made a mistake in trying some of the demo code, in that I was subscribing to two queues, but only passing in a single QOS level.
This caused an exception to be thrown:
(I was using the NuGet 4.3.0 code for this.) I couldn't catch this exception and handle it, because the true exception does not make it to the user's level. Nor could I find out what the actual exception was.
When I compiled the m2mqtt code from GitHub, I debugged it and found that MqttMsgSubscribe.GetBytes() was throwing a TopicsQosLevelsNotMatch exception:
It is the MqttClient.Send() that ignores the throw exceptions:
M2Mqtt.Net.dll!uPLibrary.Networking.M2Mqtt.MqttClient.Send(uPLibrary.Networking.M2Mqtt.Messages.MqttMsgBase msg) Line 1029
Clearly I can avoid this now that I know what was wrong, but it would be good to either log the exception or raise it to the user's level.
Thanks for all your great work on this!
Patrick+
The text was updated successfully, but these errors were encountered: