rust-lang-deprecated / failure

Error management
https://rust-lang-nursery.github.io/failure/
Apache License 2.0
1.42k stars 140 forks source link

error-chain deprecation #181

Open Yamakaky opened 6 years ago

Yamakaky commented 6 years ago

Hey, error-chain's maintainer here.

I have not been as active on error-chain maintenance as I should have (cf all the issues and PR). I'm also working less with Rust these times (I keep an eye on it though). Since it's not perfect anyway (https://github.com/rust-lang-nursery/error-chain/issues/190) and failure is an improvement on error-chain, I guess the best way to go would be to deprecate it and go full failure. It could be done with the 1.0 failure release.

I see a few points that should be solved before the full deprecation:

Do you think of it?

Not sure who should be included in this discussion.

leoschwarz commented 6 years ago

Hi. Thanks for your update.

We need to be sure that every feature from error-chain is supported by failure.

I think the biggest problem I see with this, is that the paradigms of both crates are a bit different, and in general going from error-chain to failure has involved rethinking my error handling. What's usually happened when using error-chain for me is that I end up creating ErrorKind enums with lots of variants for all possible foreign error types, so I can use try!/? everywhere, and when I port it to failure usually I only keep variants for semantic groups of errors and sometimes even box the errors. Because unlike error-chain no From conversions are implemented by failure. Instead the idea is to either map the error before trying or write your own From conversion, or if you don't care return an Error struct. (But it might be possible that I got something wrong, so please take my words with a grain of salt, I'm not involved in the development of either crate.)

My personal experience is that failure leads me to writing cleaner error handling, however I have yet to try how well it proves for debugging. Because on of the biggest selling points of error-chain for me has always been, use it everywhere (which is really easy) and you will get backtraces everywhere when you need them.

Yamakaky commented 6 years ago

Yeah, I didn't mean a 1-1 feature mapping. I meant that the use-cases are covered.

jonhoo commented 6 years ago

Should this discussion be revisited now that the path forward for failure is a little clearer and @mitsuhiko has taken over active ownership?

mitsuhiko commented 6 years ago

I feel like the issue here is now more complex as error is now being fixed in the stdlib so it's not even clear what the failure story is going to be going forward.