From 0ba6a741ab3c5b5e03305a7f9f4bd18b687377f0 Mon Sep 17 00:00:00 2001 From: Yin Guanhao Date: Wed, 25 Oct 2023 13:36:58 +0800 Subject: [PATCH] chore: improve error handling in axon --- crates/relayer/src/chain/axon.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/relayer/src/chain/axon.rs b/crates/relayer/src/chain/axon.rs index 95059ad4d..0821c3212 100644 --- a/crates/relayer/src/chain/axon.rs +++ b/crates/relayer/src/chain/axon.rs @@ -1202,14 +1202,12 @@ impl AxonChain { .rpc_client .get_block_by_id(block_number.into()) .await? - // XXX: proper error handling. - .unwrap(); + .ok_or_else(|| Error::other_error(format!("failed to get block {block_number}")))?; let state_root = self .rpc_client .get_block_by_id(previous_number.into()) .await? - // XXX: proper error handling. - .unwrap() + .ok_or_else(|| Error::other_error(format!("failed to get block {previous_number}")))? .header .state_root; let proof = loop {