-
Notifications
You must be signed in to change notification settings - Fork 49
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
Use thiserror
consistently across the crate
#62
Comments
For the node, I don't think we are aiming for |
We use both Biggest downside of |
Just to clarify, the goal here is to use |
Not sure of pros and cons - but seems like we should mostly lean on |
I would only use |
From #55 (comment).
I advocate that we use thiserror for errors across the repo.
Pros:
std::error::Error
for youDisplay
for you (with the attribute#[error("display string for error variant")]
#[from]
which implements aFrom
for the variant that it's defined on (which plays nicely with the?
operator)Cons:
no_std
, only due to the fact thatstd::error::Error
lives instd
instead ofcore
, but this is eventually going to changeAlternatives:
anyhow
oreyre
instead if we want to write "one-off errors" (no enums defined) everywhere and lose the ability to match on specific error variants. We can also use both:thiserror
for all library code, andanyhow
in the binary or anywhere we're absolutely certain the error is only meant to be printed out to the userThe text was updated successfully, but these errors were encountered: