Hacker News new | ask | show | jobs
by aiono 459 days ago
I 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.