diff --git a/daemon/src/lib.rs b/daemon/src/lib.rs index def8c6c..b02ff37 100644 --- a/daemon/src/lib.rs +++ b/daemon/src/lib.rs @@ -22,6 +22,7 @@ pub mod setup_contract; pub mod taker_cfd; pub mod to_sse_event; pub mod tokio_ext; +pub mod try_continue; pub mod wallet; pub mod wallet_sync; pub mod wire; diff --git a/daemon/src/try_continue.rs b/daemon/src/try_continue.rs new file mode 100644 index 0000000..5fa3dc3 --- /dev/null +++ b/daemon/src/try_continue.rs @@ -0,0 +1,13 @@ +/// Wrapper for errors in loop that logs error and continues +#[macro_export] +macro_rules! try_continue { + ($result:expr) => { + match $result { + Ok(value) => value, + Err(e) => { + tracing::error!("{:#}", e); + continue; + } + } + }; +}