comprehensive-rust icon indicating copy to clipboard operation
comprehensive-rust copied to clipboard

Error-handling crates slide should be split

Open fw-immunant opened this issue 1 year ago • 1 comments

We used to (in v1) separately show using thiserror (to remove the tedium of manually writing boilerplate From and Display implementations for custom error enums) and anyhow (to flatten error types and allow adding context to errors). Now we show them together, and it makes it harder to understand the value proposition of thiserror. In particular, the example does not demonstrate the #[from] attribute anymore and loses the ability to dispatch on error enums because it uses the erased anyhow::Result type.

We should split this slide back into two slides again so that we can separately address these separate concerns. thiserror provides convenience without changing semantics, while anyhow changes error semantics in a way that is mostly suitable for applications but not libraries.

fw-immunant avatar Apr 25 '24 13:04 fw-immunant

This sounds like a good idea!

djmitche avatar Apr 25 '24 13:04 djmitche