anyhow is brilliant. I've started using it in all my CLI programs and internal libraries for which structured errors aren't important. It's really lovely and pleasant to use. It's the first error helper library I've used more than once. https://docs.rs/anyhow
-
-
Replying to @burntsushi5
I've seen it used before but I'm not certain what problem it solves. Can you elaborate?
1 reply 0 retweets 1 like -
Replying to @adamnemecek1
Basically, if you would otherwise use Box<Error>, then anyhow::Error is a better version of that. It has backtraces for example, and will correctly print causal chains. It also has nice convenience constructors.
1 reply 0 retweets 5 likes -
Replying to @burntsushi5 @adamnemecek1
If your question was more about "why would I use Box<Error>," then that is a bit more involved. But the TL;DR is that you use Box<Error> when explicit structured errors aren't important or needed. A Box<Error> in that case is mostly just more succinct.
1 reply 0 retweets 3 likes -
Replying to @burntsushi5 @adamnemecek1
For a more complete story, see my blog post: https://blog.burntsushi.net/rust-error-handling …
1 reply 0 retweets 8 likes -
Replying to @burntsushi5 @adamnemecek1
Your blog was from 2015. Any plan to update it? Thanks
1 reply 0 retweets 0 likes -
Replying to @duanjingjing @adamnemecek1
There are updates posted at the top of the article........
1 reply 0 retweets 1 like -
Replying to @burntsushi5 @adamnemecek1
Sorry i bookmarked it but didn’t look carefully. Thanks for keeping it up to date! Will give it a read tonight.
1 reply 0 retweets 0 likes
But yes, I published that article right before Rust 1.0 was released. I have largely employed the same techniques described there since then. When I wrote it, I focused on the fundamentals. Those really haven't changed much.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.