Skip to content

Commit

Permalink
Improve Dispatch Errors (#878)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jsdw authored Mar 23, 2023
1 parent 7c252fc commit b5194be
Show file tree
Hide file tree
Showing 14 changed files with 673 additions and 474 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion subxt/src/blocks/block_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ where
let block_hash = self.header.hash();
let block_details = match self.client.rpc().block(Some(block_hash)).await? {
Some(block) => block,
None => return Err(BlockError::block_hash_not_found(block_hash).into()),
None => return Err(BlockError::not_found(block_hash).into()),
};

Ok(BlockBody::new(
Expand Down
2 changes: 1 addition & 1 deletion subxt/src/blocks/blocks_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ where

let block_header = match client.rpc().header(Some(block_hash)).await? {
Some(header) => header,
None => return Err(BlockError::block_hash_not_found(block_hash).into()),
None => return Err(BlockError::not_found(block_hash).into()),
};

Ok(Block::new(block_header, client))
Expand Down
307 changes: 0 additions & 307 deletions subxt/src/error.rs

This file was deleted.

Loading

0 comments on commit b5194be

Please sign in to comment.