Skip to content

Latest commit

 

History

History
22 lines (17 loc) · 673 Bytes

README.md

File metadata and controls

22 lines (17 loc) · 673 Bytes

main_error

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: