influxdb-rs / influxdb-rust

Rust Client for the InfluxDB Time Series Database
https://crates.io/crates/influxdb
MIT License
256 stars 78 forks source link

Better error handling, pattern matching instead of conditional flow #137

Closed 0xDmtri closed 7 months ago

0xDmtri commented 8 months ago

Description

Improved error handling and exhaustive handling of all the possible error codes. In original implementation only two variants of enum were handled in conditional manner (which is not robust in this case). The proposed usage of pattern matching via "match" case is a better way of handling errors. I have proposed a new enum variant for an Error that returns the standardized error code instead.

Let me know if there are any further suggestions for improvement.

Checklist

msrd0 commented 7 months ago

Did you intentionally or accidentially close this PR? If the former, would you be ok if we used your changes as a base for a new PR?

0xDmtri commented 7 months ago

Did you intentionally or accidentially close this PR? If the former, would you be ok if we used your changes as a base for a new PR?

Hey, intentionally because of the mess I made there haha. I am on track of redesigning my previous logic into something better. I will make a new PR today in the evening. Sounds good?

msrd0 commented 7 months ago

Sounds good :+1: