add a macro that sends out DC_EVENT_ERROR_NETWORK and takes an Error as parameter. DC_EVENT_ERROR_NETWORK errors may be handled differently in the uis

This commit is contained in:
B. Petersen
2020-07-21 00:33:49 +02:00
parent 2cbf2d8f65
commit e53c88ecb8

View File

@@ -41,6 +41,17 @@ macro_rules! error {
}};
}
#[macro_export]
macro_rules! error_network {
($ctx:expr, $msg:expr) => {
error_network!($ctx, $msg,)
};
($ctx:expr, $msg:expr, $($args:expr),* $(,)?) => {{
let formatted = format!($msg, $($args),*);
emit_event!($ctx, $crate::Event::ErrorNetwork(formatted));
}};
}
#[macro_export]
macro_rules! emit_event {
($ctx:expr, $event:expr) => {