|
|
|
@ -13,6 +13,21 @@ macro_rules! try_log {
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Unwrap a Result and print if it's an error
|
|
|
|
|
#[macro_export]
|
|
|
|
|
macro_rules! try_print {
|
|
|
|
|
($e:expr, $($arg:tt)*) => {
|
|
|
|
|
match $e {
|
|
|
|
|
Ok(r) => r,
|
|
|
|
|
Err(e) => {
|
|
|
|
|
let s = std::fmt::format(format_args!($($arg)*));
|
|
|
|
|
println!("{}({}) :: {} :: {}", file!(), line!(), s, e);
|
|
|
|
|
return Err(Box::from(e));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Unwrap a Result<T, E>, if it's an error then let client know and return.
|
|
|
|
|
#[macro_export]
|
|
|
|
|
macro_rules! try_send_error {
|
|
|
|
|