Transition to std::error::Error; minor cleanup#28
Conversation
Codecov Report
@@ Coverage Diff @@
## master #28 +/- ##
==========================================
- Coverage 85.09% 82.93% -2.16%
==========================================
Files 12 12
Lines 966 932 -34
==========================================
- Hits 822 773 -49
- Misses 144 159 +15
Continue to review full report at Codecov.
|
This makes imports for clients using this library more clear.
|
The codecov regression is due to the fact that we now have more explicit errors instead of sticking them in a catch-all type; I don't think this is an actual coverage regression. For that reason I'd like to request we overlook this, but if you disagree let me know and I can look for ways to explicitly test the new explicit error cases. |
jonhoo
left a comment
There was a problem hiding this comment.
Thanks for taking this on! These are a great set of changes. I've left some mostly minor notes inline. And yes, happy to overlook the coverage change.
|
@jonhoo thanks for the great review! I think I addressed everything 😄 |
| /// Data about this job's most recent failure. | ||
| pub fn failure(&self) -> &Option<Failure> { | ||
| &self.failure | ||
| } |
There was a problem hiding this comment.
I think this is the minimal set of changes I wanted to include in this PR, and only did when forced to by clippy, so Failure is still unusable. I'm happy to commit to coming back in another PR to make Failure useful, or put it into this one if preferred.
There was a problem hiding this comment.
Let's do that in a separate PR then, thanks 👍
| /// Data about this job's most recent failure. | ||
| pub fn failure(&self) -> &Option<Failure> { | ||
| &self.failure | ||
| } |
There was a problem hiding this comment.
Let's do that in a separate PR then, thanks 👍
jonhoo
left a comment
There was a problem hiding this comment.
Just a few minor nits left and then we're there 🎉
|
Thanks for sticking with this! I'll release it as a |
|
Released as 0.12.0-beta.1 🎉 |
Sounds great! |
|
Published 0.12.0-beta.1 as 0.12.0! |
Closes #8
Closes #27
This is a breaking change.
Removes
failure, and in its place implements errors as standard enums compatible withstd::error::Error, powered bythiserror.Also includes some minor cleanup and reorganization:
faktory::error::ProtocolError, which is the oldFaktoryErrortype, andfaktory::error::Error, which is all possible errors returned by the crate (one of which isfaktory::error::ProtocolError).producerandconsumernow return the top-levelfaktory::error::Errortype (this solves Use error type instead of using catch all failure::Error in Producer::con #8).Job.failureintopub, instead ofpub(crate); I did this because clippy was complaining that it's unused. If you disagree happy to change it back.This change is