You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.
Hooking into the Fail trait, we can unify all of our Result return values to be just Result<_, failure::Error>. There is also an impl From<std::error::Error> for Fail for free. This will make it a lot easier to make a lot more functions return Results where we wouldn't normally, like when locking a mutex: we can just mutex.lock()?.foo() instead of mutex.lock().unwrap().foo() without having to map_err or change the function return type.
The text was updated successfully, but these errors were encountered:
The failure crate is already outdated. The future plan is to extend and thusly fix the Error trait of the stdlib. There are several examples of how we could harness this, for example: err-derive
I believe, the most sustainable way of moving error management into a declarative pattern would be using the err-derive crate. It moves with and not against or next to std
maackle
changed the title
implement Fail for all internal error types
implement Fail for all internal error types (even better: use err-derive)
Feb 4, 2019
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
https://rust-lang-nursery.github.io/failure/intro.html
Hooking into the
Fail
trait, we can unify all of ourResult
return values to be justResult<_, failure::Error>
. There is also animpl From<std::error::Error> for Fail
for free. This will make it a lot easier to make a lot more functions return Results where we wouldn't normally, like when locking a mutex: we can justmutex.lock()?.foo()
instead ofmutex.lock().unwrap().foo()
without having tomap_err
or change the function return type.The text was updated successfully, but these errors were encountered: