Polish error handling
This commit is contained in:
parent
415ceefa00
commit
34d79e96d6
1 changed files with 8 additions and 2 deletions
|
@ -91,8 +91,10 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
|||
.abci_query(Some(path), data, Some(proof_height), true)
|
||||
.await?;
|
||||
|
||||
let proof: RawCwProof = result.clone().try_into().expect("todo");
|
||||
proof.verify(latest_app_hash.clone().into())?;
|
||||
let proof: RawCwProof = result.clone().try_into().map_err(into_string)?;
|
||||
proof
|
||||
.verify(latest_app_hash.clone().into())
|
||||
.map_err(into_string)?;
|
||||
|
||||
println!("{}", String::from_utf8(result.value.clone())?);
|
||||
|
||||
|
@ -105,6 +107,10 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn into_string<E: ToString>(e: E) -> String {
|
||||
e.to_string()
|
||||
}
|
||||
|
||||
fn latest_proof_height_hash(status: Response) -> (Height, AppHash) {
|
||||
let proof_height = {
|
||||
let latest_height = status.sync_info.latest_block_height;
|
||||
|
|
Loading…
Reference in a new issue