diff --git a/src/lib.rs b/src/lib.rs index f6f37e5..18e7f14 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -241,10 +241,15 @@ impl BunBunWorker { consumer .for_each_concurrent(None, move |delivery| { let handler = Arc::clone(&handler); - // TODO handle unwrap of delivery - let delivery = delivery.unwrap(); async move { - handler(delivery).await; + match delivery { + Err(error) => { + tracing::warn!("Received bad msg: {}", error); + } + Ok(delivery) => { + handler(delivery).await; + } + } } }) .await; @@ -263,10 +268,15 @@ impl BunBunWorker { consumer .for_each_concurrent(None, move |delivery| { let handler = Arc::clone(&handler); - // TODO handle unwrap of delivery - let delivery = delivery.unwrap(); async move { - handler(delivery).await; + match delivery { + Err(error) => { + tracing::warn!("Received bad msg: {}", error); + } + Ok(delivery) => { + handler(delivery).await; + } + } } }) .await;