Skip to content

Commit

Permalink
[thin_dump] Keep the error context for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
mingnus committed May 19, 2022
1 parent 34a0945 commit fa3b3c6
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/thin/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,7 @@ fn emit_leaf(v: &mut MappingVisitor, b: &Block) -> Result<()> {
keys,
values,
} => {
if let Err(_e) = v.visit(&path, &kr, &header, &keys, &values) {
return Err(anyhow!("couldn't emit leaf node"));
}
v.visit(&path, &kr, &header, &keys, &values)?;
}
}

Expand All @@ -223,15 +221,20 @@ where
Ok(())
}

fn emit_leaves(engine: Arc<dyn IoEngine>, out: &mut dyn MetadataVisitor, ls: &[u64]) -> Result<()> {
fn emit_leaves(
engine: Arc<dyn IoEngine>,
out: &mut dyn MetadataVisitor,
leaves: &[u64],
) -> Result<()> {
let mut v = MappingVisitor::new(out);
let proc = |b| {
emit_leaf(&mut v, &b)?;
Ok(())
};

read_for(engine, ls, proc)?;
v.end_walk().map_err(|_| anyhow!("failed to emit leaves"))
read_for(engine, leaves, proc)?;
v.end_walk()
.map_err(|e| anyhow!("failed to emit leaves: {}", e))
}

fn emit_entries(
Expand Down

0 comments on commit fa3b3c6

Please sign in to comment.