eyre-rs / eyre

A trait object based error handling type for easy idiomatic error handling and reporting in Rust applications
Apache License 2.0
1.35k stars 63 forks source link

feat!: introduce an `"anyhow"` compatibility layer feature flag #138

Closed LeoniePhiline closed 7 months ago

LeoniePhiline commented 8 months ago

This change hides the anyhow compatibility layer behind an "anyhow" feature flag. In eyre v0.6 the feature is enabled by default.

Fixes #131

Nemo157 commented 8 months ago

Note, this is a breaking change, anyone using default-features = false and the compat layer will be broken.

LeoniePhiline commented 8 months ago

Merging this on a new breaking changes branch sounds good! (Maybe better: using main as breaking changes branch and starting a 0.6 maintenance branch?)

Do I understand correctly that there is nothing to do from my side right now?

ten3roberts commented 8 months ago

Certainly, a maintenance would work and we can backport all bug fixes from main to 0.6 to prevent them being forgotten.

That is correct, there is nothing that would need to be done on your part and the feature flag is really good 😊. I spoke to Jane and we didn't find that there was any item that we missed to include under the feature flag.

LeoniePhiline commented 7 months ago

Since it's a breaking change anyway, shall we then remove it from default features right away?

Otherwise we need yet another breaking release if we are ever going to make the anyhow compatibility layer opt-in only.

ten3roberts commented 7 months ago

Absolutely, that would be great.

It would further go into our intents of making the error wrapping represent a logical error chain, rather than context attached to an error. The anyhow compatibility has unfortunately incentivized the latter approach where through API naming the error chains are treated like context stores where you can interpolate arbitrary data, such as usernames or other variables.

Making it opt-in would thus be awesome, and push towards a more descriptive chain of errors.

Do you mind opening a PR with a short explanation in the Readme of what it means and how to opt in/how it compares to anyhow?

LeoniePhiline commented 7 months ago

Yes, I can do that! I added a note to https://github.com/eyre-rs/eyre/issues/136 which already tracks that change.