Skip to content

Commit

Permalink
refactor(errors): improve message and add logging when sending tree f…
Browse files Browse the repository at this point in the history
…rom backend panics (#314)

Related #239
Related #209

---------

Signed-off-by: simonsan <[email protected]>
  • Loading branch information
simonsan authored Oct 9, 2024
1 parent 460865b commit 428fa7a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions crates/core/src/blob/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use derive_setters::Setters;
use ignore::overrides::{Override, OverrideBuilder};
use ignore::Match;

use log::debug;
use serde::{Deserialize, Deserializer};
use serde_derive::Serialize;

Expand Down Expand Up @@ -689,9 +690,17 @@ impl<P: Progress> TreeStreamerOnce<P> {
let out_tx = out_tx.clone();
let _join_handle = std::thread::spawn(move || {
for (path, id, count) in in_rx {
out_tx
.send(Tree::from_backend(&be, &index, id).map(|tree| (path, tree, count)))
.unwrap();
debug!("Loading tree {id} from {path:?} with count {count}");

if let Err(err) = out_tx.try_send(
Tree::from_backend(&be, &index, id).map(|tree| (path, tree, count)),
) {
panic!("
Sending tree {id} on channel failed: {err}.
This should not happen! Please report it to the developers: https://github.com/rustic-rs/rustic_core/issues/new
");
}
}
});
}
Expand Down

0 comments on commit 428fa7a

Please sign in to comment.