Skip to content

Commit 7a67cf7

Browse files
committed
cln-plugin: don't panic if notification handler returns error
Changelog-None
1 parent deae922 commit 7a67cf7

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

plugins/src/lib.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,11 @@ where
813813
match &self.wildcard_subscription {
814814
Some(cb) => {
815815
let call = cb(plugin.clone(), params.clone());
816-
tokio::spawn(async move { call.await.unwrap() });
816+
tokio::spawn(async move {
817+
if let Err(e) = call.await {
818+
log::warn!("Wildcard notification handler error: '{}'", e)
819+
}
820+
});
817821
}
818822
None => {}
819823
};
@@ -823,7 +827,11 @@ where
823827
match self.subscriptions.get(method) {
824828
Some(cb) => {
825829
let call = cb(plugin.clone(), params.clone());
826-
tokio::spawn(async move { call.await.unwrap() });
830+
tokio::spawn(async move {
831+
if let Err(e) = call.await {
832+
log::warn!("Notification handler error: '{}'", e)
833+
}
834+
});
827835
}
828836
None => {
829837
if self.wildcard_subscription.is_none() {

0 commit comments

Comments
 (0)