-
Notifications
You must be signed in to change notification settings - Fork 15
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
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. |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do that in a separate PR then, thanks 👍
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.
We're very nearly there!
/// Data about this job's most recent failure. | ||
pub fn failure(&self) -> &Option<Failure> { | ||
&self.failure | ||
} |
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.
Let's do that in a separate PR then, thanks 👍
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.
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 oldFaktoryError
type, andfaktory::error::Error
, which is all possible errors returned by the crate (one of which isfaktory::error::ProtocolError
).producer
andconsumer
now return the top-levelfaktory::error::Error
type (this solves Use error type instead of using catch all failure::Error in Producer::con #8).Job.failure
intopub
, 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