Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
fixed panic when io is not available for export block, closes #7486 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
debris authored and tomusdrw committed Jan 8, 2018
1 parent 33b8f28 commit 7316cb9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions parity/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,12 @@ fn execute_export(cmd: ExportBlockchain) -> Result<(), String> {
}
let b = client.block(BlockId::Number(i)).ok_or("Error exporting incomplete chain")?.into_inner();
match format {
DataFormat::Binary => { out.write(&b).expect("Couldn't write to stream."); }
DataFormat::Hex => { out.write_fmt(format_args!("{}", b.pretty())).expect("Couldn't write to stream."); }
DataFormat::Binary => {
out.write(&b).map_err(|e| format!("Couldn't write to stream. Cause: {}", e))?;
}
DataFormat::Hex => {
out.write_fmt(format_args!("{}", b.pretty())).map_err(|e| format!("Couldn't write to stream. Cause: {}", e))?;
}
}
}

Expand Down

0 comments on commit 7316cb9

Please sign in to comment.