Skip to content

Commit

Permalink
Simplify error wraps
Browse files Browse the repository at this point in the history
  • Loading branch information
hrls committed Jul 30, 2024
1 parent 1c05d0e commit 5daf9ac
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ pub fn run() -> sc_cli::Result<()> {
let apis_hash = sp_io::hashing::keccak_256(&api_bytes);
let mut hash_str = String::new();
for byte in apis_hash {
write!(&mut hash_str, "{:02x}", byte)
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))
.map_err(sc_cli::Error::Io)?;
write!(&mut hash_str, "{:02x}", byte).map_err(|e| {
std::io::Error::new(std::io::ErrorKind::Other, e.to_string())
})?;
}
hash_str
};
Expand All @@ -269,9 +269,7 @@ pub fn run() -> sc_cli::Result<()> {
"apis_hash": apis_hash,
});

let json = serde_json::to_string_pretty(&json)
.map_err(std::io::Error::from)
.map_err(sc_cli::Error::Io)?;
let json = serde_json::to_string_pretty(&json).map_err(std::io::Error::from)?;
println!("{}", json);

Ok(())
Expand Down

0 comments on commit 5daf9ac

Please sign in to comment.