human_panic

Macro setup_panic

source
macro_rules! setup_panic {
    ($meta:expr) => { ... };
    () => { ... };
}
Expand description

human-panic initialisation macro

You can either call this macro with no arguments setup_panic!() or with a Metadata struct, if you don’t want the error message to display the values used in your Cargo.toml file.

The Metadata struct can’t implement Default because of orphan rules, which means you need to provide all fields for initialisation.

The macro should be called from within a function, for example as the first line of the main() function of the program.

use human_panic::setup_panic;
use human_panic::Metadata;

setup_panic!(Metadata::new(env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"))
    .authors("My Company Support <support@mycompany.com>")
    .homepage("support.mycompany.com")
    .support("- Open a support request by email to support@mycompany.com")
);