trap_panics_and_errors

Macro trap_panics_and_errors 

Source
macro_rules! trap_panics_and_errors {
    ($error_id:literal , $main:expr) => { ... };
}
Expand description

trap_panics_and_errors traps panics that might be issued when calling a given function It will print a nice error message in case a panic is trapped. This macro also traps errors, prints the error and exists the program with error code 1

NOTE the Err type returned by the given function must return an Err that implements the Display trait.