Skip to content

Commit

Permalink
refactor(iroh): log inner errors (#2423)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
rklaehn committed Jun 28, 2024
1 parent 3659628 commit da3f84b
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions iroh/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,22 @@ impl<D: iroh_blobs::store::Store> NodeInner<D> {
},
// handle task terminations and quit on panics.
res = join_set.join_next(), if !join_set.is_empty() => {
if let Some(Err(err)) = res {
error!("Task failed: {err:?}");
break;
match res {
Some(Err(outer)) => {
if outer.is_panic() {
error!("Task panicked: {outer:?}");
break;
} else if outer.is_cancelled() {
debug!("Task cancelled: {outer:?}");
} else {
error!("Task failed: {outer:?}");
break;
}
}
Some(Ok(Err(inner))) => {
debug!("Task errored: {inner:?}");
}
_ => {}
}
},
else => break,
Expand Down

0 comments on commit da3f84b

Please sign in to comment.