habitat-sh / habitat

Modern applications with built-in automation
https://www.habitat.sh
Apache License 2.0
2.61k stars 315 forks source link

Use the failure crate for errors #6558

Open christophermaier opened 5 years ago

christophermaier commented 5 years ago

The failure crate (documentation here) provides a more modern approach to Rust error handling than the std::error::Error trait, while remaining backward compatible with it.

It has a lot of nice features, including lots of automatic trait derivation to reduce boilerplate, cause chaining, backtrace support, and context (which would be a huge win for making all the IO errors we can throw more intelligible).

We should dig into this crate to help improve our error handling story.

christophermaier commented 5 years ago

Might not want to use failure after all, based on https://users.rust-lang.org/t/the-state-of-error-handling-in-the-2018-edition/23263/26

If we could find a better way to deal with error context, at least for our I/O errors, that would be nice; that was really the most exciting thing about failure for me, anyway.

christophermaier commented 4 years ago

https://github.com/dtolnay/thiserror and https://github.com/dtolnay/anyhow are interesting new crates in this area to check out.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you.

stale[bot] commented 1 year ago

This issue has been automatically closed after being stale for 400 days. We still value your input and contribution. Please re-open the issue if desired and leave a comment with details.