> You could provide a bespoke error type for every single function that returns an error, but that's a ton of boilerplate
If we had more typescript-like discriminated union semantics a lot of the boilerplate would go away. Throw in automatic implementation of From traits for enums composed of other enums / types and it could be pretty close to perfect.