Crates.io | main_error |
lib.rs | main_error |
version | 0.1.2 |
source | src |
created_at | 2019-09-24 12:38:47.188144 |
updated_at | 2021-09-12 11:12:12.93155 |
description | Print errors with Display instead of Debug when using ? in main(). |
homepage | |
repository | https://github.com/danleh/main_error |
max_upload_size | |
id | 167277 |
size | 9,381 |
Print errors with Display
instead of Debug
when using ?
in main()
. For example:
use main_error::MainError;
fn main() -> Result<(), MainError> {
// This prints
// "Error: invalid digit found in string"
// instead of (if you used `Result<(), Box<dyn Error>>` or similar)
// "ParseIntError { kind: InvalidDigit }".
let number: i32 = "not a number".parse()?;
Ok(())
}
For more info, see: