Browse Source

Macro to trace errors in loop and continue

hotfix/0.1.1
Daniel Karzel 3 years ago
parent
commit
7b40667d4d
No known key found for this signature in database GPG Key ID: 30C3FC2E438ADB6E
  1. 1
      daemon/src/lib.rs
  2. 13
      daemon/src/try_continue.rs

1
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;

13
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;
}
}
};
}
Loading…
Cancel
Save