From 7a67cf76ea030173efbf1cbdba19955b4c1f5a54 Mon Sep 17 00:00:00 2001 From: daywalker90 <8257956+daywalker90@users.noreply.github.com> Date: Mon, 31 Mar 2025 12:13:40 +0200 Subject: [PATCH] cln-plugin: don't panic if notification handler returns error Changelog-None --- plugins/src/lib.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/src/lib.rs b/plugins/src/lib.rs index 1b1ddf268e9a..112459aeda01 100644 --- a/plugins/src/lib.rs +++ b/plugins/src/lib.rs @@ -813,7 +813,11 @@ where match &self.wildcard_subscription { Some(cb) => { let call = cb(plugin.clone(), params.clone()); - tokio::spawn(async move { call.await.unwrap() }); + tokio::spawn(async move { + if let Err(e) = call.await { + log::warn!("Wildcard notification handler error: '{}'", e) + } + }); } None => {} }; @@ -823,7 +827,11 @@ where match self.subscriptions.get(method) { Some(cb) => { let call = cb(plugin.clone(), params.clone()); - tokio::spawn(async move { call.await.unwrap() }); + tokio::spawn(async move { + if let Err(e) = call.await { + log::warn!("Notification handler error: '{}'", e) + } + }); } None => { if self.wildcard_subscription.is_none() {