-
Notifications
You must be signed in to change notification settings - Fork 210
replace deprecated failure library with anyhow and thiserror #1456
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
Conversation
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.
This breaks cargo build --features consistency-check
- can you fix that while you're at it?
If you could give an example of a backtrace after this change, that would be super helpful :)
@@ -289,125 +304,133 @@ impl RustwideBuilder { | |||
} | |||
|
|||
let mut build_dir = self.workspace.build_dir(&format!("{}-{}", name, version)); | |||
build_dir.purge()?; | |||
build_dir.purge().map_err(FailureError::compat)?; |
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.
There's an awful lot of FailureError::compat
in this file - could we maybe return a failure::Error
from build_package()
so we only have to convert it once? Or does that break backtraces because they're not stable in std?
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.
there I'm really not sure what's best, could be come tricky.
This probably would mean changing the return types for more methods on RustwideBuilder
, which then means converting the errors each time when we call out of the class.
I'll try to play around with some boundaries and then see if something looks better.
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.
If it's hard no worries, this is fine as-is.
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.
( there is a chance it's also just too much for my rust-skills, I saw parts of the approach in the branch by Nemo)
self.repository_stats_updater.load_repository(metadata) | ||
self.repository_stats_updater | ||
.load_repository(metadata) | ||
.map_err(Into::into) |
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.
Hmm, why not return a failure::Result
from load_repository
?
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.
that's probably the problem with the partial migration without rustwide :)
in the end, I wanted most part migrated, that includes the repository stats :)
Simple example from running
another error triggered in rustwide (unknow docker image):
|
remembering that the failure crate is deprecated I replaced it with the recommended replacements.
Result<T, Error
withanyhow::Result<T>
Some code by the WIP branch by @Nemo157.
I'm happy to add any improvements.