Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(errors): improve message and add logging when sending tree from backend panics #314

Merged
merged 8 commits into from
Oct 9, 2024
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