2 ms·
IMHO conversions between various “error types” are quite common when gluing together different APIs. Like when you are chaining a handful of Result-returning ca
by zoul 7y ago
IMHO conversions between various “error types” are quite common when gluing together different APIs. Like when you are chaining a handful of Result-returning calls and there’s one in the middle that returns errors using Option.
- coolsunglasses 7y agoThis is exactly right. We habitually lift `Maybe`/`Option` values into a more explicit and comprehensive `Either`/`Result` type in our programs. It's pretty common to have an error type hierarchy in the program too, so you could find yourself chaining from one `Either e` to another. There are libraries in Haskell and Rust for regularizing/code-gen'ing these patterns.