Macro info_utils::error

source ·
macro_rules! error {
    ($($msg:tt)*) => { ... };
}
Expand description

Error

Logs errors and then kills the program with exit code 1.

⚠WARNING⚠

error! creates a hook for panic! which also silences the typical error message. This hook applies to ALL uses of panic once error! has been invoked. The panic! macro will be affected for the rest of your program’s runtime.

Examples

Kill program

    // Something is happening..
    // Uh oh, an error has occurred.
    error!("Something unrecoverable went wrong!");

Kill thread

thread::spawn(|| {
    // Do a calculation
    // Oh no, an error happened and we need to kill the thread!
    error!("Noncritical error, thread aborting");
}).join().eval_or_default();