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.
thiserror
does not appear in the public API of a crate, which makes it incredibly useful for libraries (NB:derive(Error)
fromthiserror
is not limited toenum
s). Downstream crates depending onthiserror
can use the returned error like any otherError
. Application-type errors likeanyhow
oreyre
do appear in the public API. Additionally, error types from application-type errors usually don't implementError
(but usually implement a way returning a&dyn Error
like usingAsRef<&dyn Error>
).error_stack::Report
does not (and will not) implementError
. However, we plan to implement a way …