重新抛出异常

异常处理

use std::io::ErrorKind;

fn test_error() -> Result<(), ErrorKind> {
    Err(ErrorKind::NotFound) 
}

fn fn_with_exception() -> Result<(), ErrorKind> {
    test_error()?;
    Ok(())
}

if let Err(err) = fn_with_exception() {
    println!("{}", err);
}