← Back to context

Comment by EugeneOZ

10 years ago

I know this and I don't like this. Every level of abstraction should have own errors, without dependencies on some other errors, otherwise code will be too fragile. And it's not theoretical assumption, but lessons from practice.

It's not clear why you think that From/map_err don't let you separate errors at levels of abstractions. It gets done all the time.

And error-chain exists if you want a more fluid system of errors.

And if you don't trust me in this question, you can try to read Uncle Bob. I thought it's not applicable to Rust (because initially it was about OOP), but on one of refactorings I got a lot of broken dependencies in From trait. Then I realized good rules worth to be remembered.