Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

rust error handling

match do_steps() {
    Ok(_) => (),
    _ => alert_user("Failed to perform necessary steps")
}

// Additional function:
fn do_steps() -> Result<(), Error>{
    do_step_1()?;
    do_step_2()?;
    do_step_3()?;
    // etc
    Ok(())
}
 
PREVIOUS NEXT
Tagged: #rust #error #handling
ADD COMMENT
Topic
Name
3+3 =