Skip to content

Commit da3f84b

Browse files
authored
refactor(iroh): log inner errors (#2423)
## Description we currently abort the loop on outer errors (errors from spawn). But we do not look at inner errors (task returns properly but returns an error) at all. This logs the inner errors as debug! and coninues. Also checks if the outer error is actually a panic, and continues the loop otherwise. ## Breaking Changes ## Notes & open questions ## Change checklist - [ ] Self-review. - [ ] Documentation updates if relevant. - [ ] Tests if relevant. - [ ] All breaking changes documented.
1 parent 3659628 commit da3f84b

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

iroh/src/node.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,22 @@ impl<D: iroh_blobs::store::Store> NodeInner<D> {
308308
},
309309
// handle task terminations and quit on panics.
310310
res = join_set.join_next(), if !join_set.is_empty() => {
311-
if let Some(Err(err)) = res {
312-
error!("Task failed: {err:?}");
313-
break;
311+
match res {
312+
Some(Err(outer)) => {
313+
if outer.is_panic() {
314+
error!("Task panicked: {outer:?}");
315+
break;
316+
} else if outer.is_cancelled() {
317+
debug!("Task cancelled: {outer:?}");
318+
} else {
319+
error!("Task failed: {outer:?}");
320+
break;
321+
}
322+
}
323+
Some(Ok(Err(inner))) => {
324+
debug!("Task errored: {inner:?}");
325+
}
326+
_ => {}
314327
}
315328
},
316329
else => break,

0 commit comments

Comments
 (0)