1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-12-14 22:15:54 +02:00

Clarify usage for thiserror-and-anyhow (#1724)

IMO it is better to explain to users the common usage / applicability
domain for anyhow and thiserror crates

---------

Co-authored-by: Dustin J. Mitchell <djmitche@google.com>
This commit is contained in:
Yuri Astrakhan 2024-01-18 15:28:00 -05:00 committed by GitHub
parent 9d9b4170e4
commit 1dfc9f2e33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,9 +6,12 @@ minutes: 5
The [`thiserror`](https://docs.rs/thiserror/) and
[`anyhow`](https://docs.rs/anyhow/) crates are widely used to simplify error
handling. `thiserror` helps create custom error types that implement `From<T>`.
`anyhow` helps with error handling in functions, including adding contextual
information to your errors.
handling.
- `thiserror` is often used in libraries to create custom error types that
implement `From<T>`.
- `anyhow` is often used by applications to help with error handling in
functions, including adding contextual information to your errors.
```rust,editable,compile_fail
use anyhow::{bail, Context, Result};