-
Notifications
You must be signed in to change notification settings - Fork 68
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
Converting from anyhow::Error #31
Comments
the best way to convert between the two would be to first convert the anyhow::Error to a |
that makes sense, thanks! |
Just for future readers: foo().map_err(|err| eyre!(Box::new(err)) |
With both the above issues in mind, is it worth adding some code in this crate under |
Alternatively you can wrap this inside a declarative macro map_err!(foo())?;
#[macro_export]
macro_rules! map_err {
($fun:expr) => {
$fun.map_err(|e| eyre!(Box::new(e)))
}
} |
@yaahc Please let me know if you welcome a PR |
I've no objections to adding an anyhow_compat feature, PRs welcome |
What's the status of this feature? |
I would also be interested in that. Some other coded in my project uses anyhow and manually mapping the errors is quite a pain.. |
Hi,
I am porting multiple crates from anyhow to eyre, so I have code that looks something like this:
This, as expected, gives
Since
anyhow::Error
andeyre::Report
are so similar, is there a better way to construct aneyre::Report
mid-stack than this, which is sad and throws out the context:Thanks for the help!
The text was updated successfully, but these errors were encountered: