Some resources:
- https://doc.rust-lang.org/book/ch09-00-error-handling.html
- https://users.rust-lang.org/t/the-state-of-error-handling-in-the-2018-edition/23263/25
- repo: https://github.com/WiSaGaN/simple-error
- timeline: 2016-03-23 to 2019-10-23
- status: development ongoing
simple-error is a Rust library that provides a simple Error type backed by a String. It is best used when all you care about the error is an error string.
- repo: https://github.com/dtolnay/anyhow
- timeline: 2019-10-04 to 2019-11-28 (ongoing)
- status: development ongoing
This library provides anyhow::Error, a trait object based error type for easy idiomatic error handling in Rust applications.
Comparison to failure: The anyhow::Error type works something like failure::Error, but unlike failure ours is built around the standard library's std::error::Error trait rather than a separate trait failure::Fail. The standard library has adopted the necessary improvements for this to be possible as part of RFC 2504.
Comparison to thiserror: Use Anyhow if you don't care what error type your functions return, you just want it to be easy. This is common in application code. Use thiserror if you are a library that wants to design your own dedicated error type(s) so that on failures the caller gets exactly the information that you choose.
- repo: https://github.com/dtolnay/thiserror
- timeline: 2019-10-08 to 2019-12-18 (ongoing)
- status: development ongoing
This library provides a convenient derive macro for the standard library's std::error::Error trait.
Thiserror deliberately does not appear in your public API. You get the same thing as if you had written an implementation of std::error::Error by hand, and switching from handwritten impls to thiserror or vice versa is not a breaking change.
- repo: https://github.com/withoutboats/fehler
- commits: 2019-07-16 to 2019-11-22
- status: development ongoing
Der Fehler is a library to add support for "throwing functions" to Rust through procedural macros. Functions marked with the throws attribute return Result, but the "Ok" path is used by default and you don't need to wrap ok return values in Ok. To throw errors, use ? or the throws macro.
- repo: https://github.com/shepmaster/snafu
- commits: 2019-01-27 to 2019-11-13
- status: development ongoing
SNAFU is a library to easily assign underlying errors into domain-specific errors while adding context.
- repo: https://github.com/rust-lang-nursery/failure
- commits: 2017-09-25 to 2019-10-11
- status:
- the 0.1 branch seems to be less actively developed
- a 0.2 branch has been discussed; see rust-lang-deprecated/failure#287