From 8c78061743cf65bd78f4707bced4302266faab57 Mon Sep 17 00:00:00 2001 From: helin6 <577522102@qq.com> Date: Thu, 27 Jul 2023 14:45:55 +0800 Subject: [PATCH] fix DispatchError display --- subxt/src/error/mod.rs | 4 ++-- subxt/src/tx/tx_progress.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/subxt/src/error/mod.rs b/subxt/src/error/mod.rs index 70685f1a31..51bfc3f82e 100644 --- a/subxt/src/error/mod.rs +++ b/subxt/src/error/mod.rs @@ -44,8 +44,8 @@ pub enum Error { #[error("Metadata: {0}")] MetadataDecoding(#[from] MetadataTryFromError), /// Runtime error. - #[error("Runtime error: {0:?}")] - Runtime(#[from] DispatchError), + #[error("Runtime error: {}", .0.to_string())] + Runtime(DispatchError), /// Error decoding to a [`crate::dynamic::Value`]. #[error("Error decoding into dynamic value: {0}")] Decode(#[from] DecodeError), diff --git a/subxt/src/tx/tx_progress.rs b/subxt/src/tx/tx_progress.rs index 97aa77e8c3..e5eaf3fbd1 100644 --- a/subxt/src/tx/tx_progress.rs +++ b/subxt/src/tx/tx_progress.rs @@ -362,7 +362,7 @@ impl> TxInBlock { if ev.pallet_name() == "System" && ev.variant_name() == "ExtrinsicFailed" { let dispatch_error = DispatchError::decode_from(ev.field_bytes(), self.client.metadata())?; - return Err(dispatch_error.into()); + return Err(Error::Runtime(dispatch_error)); } }