Hacker News new | ask | show | jobs
by a5huynh 1212 days ago
I've run into similar issues and found that the `thiserror` crate (https://crates.io/crates/thiserror) combined w/ anyhow makes a lot of that pain go away
3 comments

For those reading this that aren't super familiar, common Rust advice is "use thiserror for libraries and anyhow for applications," as they make slightly different tradeoffs and so are useful, especially together.
`anyhow` + `?` make writing an application as smooth as butter. You won't miss exceptions.

Don't use `anyhow` for libraries, though. You want to provide your consumers the ability to `match`.

here we go again!
I would add `snafu`(https://crates.io/crates/snafu) here as a good alternative to thiserror+anyhow.