diff --git a/parity/blockchain.rs b/parity/blockchain.rs index b1bf8d4db..84a610ef3 100644 --- a/parity/blockchain.rs +++ b/parity/blockchain.rs @@ -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))?; + } } }