3 ms·
Rust does a great job here. I know it is based upon other languages but error handling in Rust doesn’t suck
by sherdil2022 2y ago
Rust does a great job here. I know it is based upon other languages but error handling in Rust doesn’t suck
- aiono 2y agoI like many aspects of Rust's error handling, but I think it still lacks the composability part. Its not straightforward to compose two functions that return different failure sets. One thing you can do is to merge enums for both functions, than you lost what failures each individual function can have and having to do that is a lot of unnecessary work. Other option is you can return a boxed trait then you no more encode what errors are return from each function. User has to rely on reading the documentation for what kind of errors can occur.