azure-iot-sdk-rs icon indicating copy to clipboard operation
azure-iot-sdk-rs copied to clipboard

Better error handling

Open damienpontifex opened this issue 5 years ago • 2 comments

Handle errors with iot hub error type and communicate issues back to main program

damienpontifex avatar Apr 18 '20 04:04 damienpontifex

I think I was about to open a duplicate issue. Does this refer to making network operations return results instead of panicking?

e.g.

https://github.com/damienpontifex/azure-iot-sdk-rs/blob/e30a9ad2d8b10264f230d96d78ee8ffea216dfb3/src/mqtt_transport.rs#L201-L215

A panic on line 202 indicates a downstream user's failure to use the library correctly or a bug in the topic name building logic, so should continue to panic, but line 214 could fail due to a network issue and should propagate the result in an error type defined by this library.

Just clarifying as I will probably take a stab at this.

Do you want to preserve the existing API and add a new API that returns results or are you thinking just breaking the API by replacing it?

rubberduck203 avatar Sep 08 '20 15:09 rubberduck203

Exactly @rubberduck203 - make things like network errors that should be recoverable/retryable or to reconnect surface to the developer at least.

Current version is still 0.x so I'm happy introducing breaking changes to the API :)

damienpontifex avatar Sep 20 '20 06:09 damienpontifex