4 ms·
Notice: Failure lib is deprecated now
by kosolam 6y ago
Notice: Failure lib is deprecated now
- csomar 6y agoYou can use the newError branch: https://github.com/rust-starter/rust-starter/tree/newError https://github.com/rust-starter/rust-starter/tree/newError See https://rust-starter.github.io/#feature-errors https://rust-starter.github.io/#feature-errors for why Failure is still used.
- kibwen 6y agoIndeed, much of what Failure did well has since been upstreamed into Rust's own std::error::Error type. The modern recommendations for error handling convenience libs are thiserror (for library crates, where you want to define errors) and anyhow (for binary crates, where you just want to consume errors), both of which are from the author of Serde. [EDIT: Also snafu, hello there Shepmaster :P ]
- csomar 6y agoUnfortunately, backtracing is only available in nightly for thiserror and anyhow.
- codetrotter 6y agoNonetheless starting people off with something deprecated is not a good idea imo, and will only serve to making migration harder in the future because more and more people keep using said deprecated thing.
- csomar 6y agoYou can switch to the newError branch. One of the things that I like when building stuff for production is that my code compiles on Stable.
- eat_veggies 6y agoDo people still recommend snafu?
- ibraheemdev 6y agoYes, why wouldn't they?
- eat_veggies 6y agoI was just wondering. I'm new to rust and still getting my bearings. Seems like there's a lot of options for error handling, from doing it yourself with an enum to snafu to thiserror and anyhow or (apparently deprecated) failure
- shepmaster 6y agoYep! Really, most of the error handling libraries just reduce the boilerplate associated with creating your own error types. SNAFU also adds some opinions to the mix. You can see what the libraries do by expanding the procedural macros they use. When you look at the output, it's nothing special that you couldn't have done yourself!
- shepmaster 6y agoI (the author of SNAFU) absolutely recommend it! It works well for libraries and applications and has bells and whistles you might want, such as backtrace captures on stable Rust.