thiserror
Custom error types.
Why Custom Errors?
Libraries should expose meaningful error types so callers can react to specific failures. Writing these by hand means lots of boilerplate. The thiserror crate generates it for you.
Adding thiserror
Add it as a dependency. It is a derive-macro crate with zero runtime cost.
[dependencies]
thiserror = "1.0"