error-stack: Use along with or replacing thiserror?
#736
-
|
I'm trying to understand how does Which layer does |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi @dpc! The main difference between library-type errors and application-type errors is how it's exposed.
Using
|
Beta Was this translation helpful? Give feedback.
Hi @dpc!
The main difference between library-type errors and application-type errors is how it's exposed.
thiserrordoes not appear in the public API of a crate, which makes it incredibly useful for libraries (NB:derive(Error)fromthiserroris not limited toenums). Downstream crates depending onthiserrorcan use the returned error like any otherError. Application-type errors likeanyhoworeyredo appear in the public API. Additionally, error types from application-type errors usually don't implementError(but usually implement a way returning a&dyn Errorlike usingAsRef<&dyn Error>).error_stack::Reportdoes not (and will not) implementError. However, we plan to implement a way …