Crates.io | snafu-cli-debug |
lib.rs | snafu-cli-debug |
version | 0.1.1 |
source | src |
created_at | 2019-07-08 14:16:20.863631 |
updated_at | 2019-09-08 11:45:52.212236 |
description | Derive a debug implementation on snafu errors that prints pretty CLI output |
homepage | |
repository | https://github.com/killercup/snafu-cli-debug |
max_upload_size | |
id | 147551 |
size | 22,838 |
The challenge: Error handling in Rust.
The approach: Embrace Result
s!
The problem: It's not easy to give add nice contexts to errors.
The solution: Snafu!
The challenge: Printing errors in CLI apps.
The approach: Embrace fn main() -> Result<(), Error>
!
The problem: It prints using Debug
, i.e., like println!("{:?}", error)
.
The solution: This crate!
See example.
$ cargo run --example simple -q -- foo
Error: Can't read file `foo`
cause: No such file or directory (os error 2)
$ cargo run --example simple -q -- foo
Error: Can't read file `foo`
cause: No such file or directory (os error 2)
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.