diff --git a/subxt/src/error/dispatch_error.rs b/subxt/src/error/dispatch_error.rs index 22f8abc774..2946729778 100644 --- a/subxt/src/error/dispatch_error.rs +++ b/subxt/src/error/dispatch_error.rs @@ -171,7 +171,9 @@ impl ModuleError { let pallet = self.metadata.pallet_by_index_err(self.pallet_index())?; let variant = pallet .error_variant_by_index(self.error_index()) - .ok_or_else(|| MetadataError::VariantIndexNotFound(self.error_index()))?; + .ok_or_else(|| MetadataError::VariantIndexNotFound { + variant_idx: self.error_index(), + })?; Ok(ModuleErrorDetails { pallet, variant }) } diff --git a/subxt/src/error/mod.rs b/subxt/src/error/mod.rs index 53803450f1..ea3736e505 100644 --- a/subxt/src/error/mod.rs +++ b/subxt/src/error/mod.rs @@ -85,13 +85,13 @@ pub enum Error { impl From for Error { fn from(value: CoreError) -> Self { match value { - CoreError::Codec(e) => Error::Codec(e), - CoreError::Metadata(e) => Error::Metadata(e), - CoreError::StorageAddress(e) => Error::StorageAddress(e), - CoreError::Decode(e) => Error::Decode(e), - CoreError::Encode(e) => Error::Encode(e), - CoreError::ExtrinsicParams(e) => Error::ExtrinsicParams(e), - CoreError::Block(e) => Error::Block(e.into()), + CoreError::Codec { source: e } => Error::Codec(e.0), + CoreError::Metadata { source: e } => Error::Metadata(e), + CoreError::StorageAddress { source: e } => Error::StorageAddress(e), + CoreError::Decode { source: e } => Error::Decode(e.0), + CoreError::Encode { source: e } => Error::Encode(e.0), + CoreError::ExtrinsicParams { source: e } => Error::ExtrinsicParams(e), + CoreError::Block { source: e } => Error::Block(e.into()), } } } @@ -187,8 +187,8 @@ impl From for BlockError { fn from(value: CoreBlockError) -> Self { match value { CoreBlockError::MissingType => BlockError::MissingType, - CoreBlockError::UnsupportedVersion(n) => BlockError::UnsupportedVersion(n), - CoreBlockError::DecodingError(e) => BlockError::DecodingError(e), + CoreBlockError::UnsupportedVersion { version: n } => BlockError::UnsupportedVersion(n), + CoreBlockError::DecodingError { source: e } => BlockError::DecodingError(e.0), } } } diff --git a/subxt/src/storage/storage_type.rs b/subxt/src/storage/storage_type.rs index 1509db9b33..7def65f34f 100644 --- a/subxt/src/storage/storage_type.rs +++ b/subxt/src/storage/storage_type.rs @@ -268,7 +268,9 @@ where self.client .metadata() .pallet_by_name(pallet_name.as_ref()) - .ok_or_else(|| MetadataError::PalletNameNotFound(pallet_name.as_ref().into()))?; + .ok_or_else(|| MetadataError::PalletNameNotFound { + name: pallet_name.as_ref().into(), + })?; // construct the storage key. This is done similarly in `frame_support::traits::metadata::StorageVersion::storage_key()`. pub const STORAGE_VERSION_STORAGE_KEY_POSTFIX: &[u8] = b":__STORAGE_VERSION__:";