#[macro_export]
macro_rules! not_recoverable_error {
( on_cond $result_obj:expr, $literal_str:expr ) => {{
const MSG: &str = $literal_str;
if !($result_obj) {
error!("not_recoverable_error: {} at {}:{}", $literal_str, file!(), line!());
panic!(
"Currently no custom handler connected for panic, using rust one. Panicked with {}",
$literal_str
);
}
}};
( on_err $result_obj:expr, $literal_str:expr ) => {{
const MSG: &str = $literal_str;
if ($result_obj).is_err() {
let err = ($result_obj).unwrap_err();
error!("not_recoverable_error: {} with error {:?}", $literal_str, err);
panic!(
"Currently no custom handler connected for panic, using rust one. Panicked with {} with {:?}",
$literal_str, err
);
}
}};
( with $obj_to_log:expr, $literal_str:expr ) => {{
const MSG: &str = $literal_str;
error!("not_recoverable_error: {}. with {:?}", $literal_str, $obj_to_log);
panic!(
"Currently no custom handler connected for panic, using rust one. Panicked with {} with {:?}",
$literal_str, $obj_to_log
);
}};
( $literal_str:expr ) => {{
const MSG: &str = $literal_str;
error!("not_recoverable_error: {}", $literal_str);
panic!(
"Currently no custom handler connected for panic, using rust one. Panicked with {}",
$literal_str
);
}};
}