mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 02:21:14 +00:00
Improve Dispatch Errors (#878)
* better dispatch errors * dry_run to use same DispatchError * fix dry_run_fails; use correct transfer amount * Hide ModuleError impl and avoid pulling details from metadata unless user needs them * fix tests * actually fix the tests (hopefully..) * Add a couple more DispatchError test cases * Add a comment about where the error was copied from * Also expose a way to obtain the raw module error data * Remove redundant variant prefixes * explicit lifetime on From<str> for clarity * fmt
This commit is contained in:
@@ -324,7 +324,7 @@ impl<T: Config, C: OnlineClientT<T>> TxInBlock<T, C> {
|
||||
let ev = ev?;
|
||||
if ev.pallet_name() == "System" && ev.variant_name() == "ExtrinsicFailed" {
|
||||
let dispatch_error =
|
||||
DispatchError::decode_from(ev.field_bytes(), &self.client.metadata());
|
||||
DispatchError::decode_from(ev.field_bytes(), self.client.metadata())?;
|
||||
return Err(dispatch_error.into());
|
||||
}
|
||||
}
|
||||
@@ -344,7 +344,7 @@ impl<T: Config, C: OnlineClientT<T>> TxInBlock<T, C> {
|
||||
.rpc()
|
||||
.block(Some(self.block_hash))
|
||||
.await?
|
||||
.ok_or(Error::Transaction(TransactionError::BlockHashNotFound))?;
|
||||
.ok_or(Error::Transaction(TransactionError::BlockNotFound))?;
|
||||
|
||||
let extrinsic_idx = block
|
||||
.block
|
||||
@@ -357,7 +357,7 @@ impl<T: Config, C: OnlineClientT<T>> TxInBlock<T, C> {
|
||||
})
|
||||
// If we successfully obtain the block hash we think contains our
|
||||
// extrinsic, the extrinsic should be in there somewhere..
|
||||
.ok_or(Error::Transaction(TransactionError::BlockHashNotFound))?;
|
||||
.ok_or(Error::Transaction(TransactionError::BlockNotFound))?;
|
||||
|
||||
let events = EventsClient::new(self.client.clone())
|
||||
.at(Some(self.block_hash))
|
||||
|
||||
Reference in New Issue
Block a user