Obtain DispatchError::Module info dynamically (#453)

* Add error information back into metadata to roll back removal in #394

* Go back to obtaining runtime error info

* re-do codegen too to check that it's all gravy

* Convert DispatchError module errors into a module variant to make them easier to work with

* Fix broken doc link
This commit is contained in:
James Wilson
2022-02-17 13:45:57 +00:00
committed by GitHub
parent eeb8b4b741
commit e866d744de
10 changed files with 1670 additions and 1610 deletions
+6 -7
View File
@@ -154,9 +154,9 @@ async fn transfer_error() {
let alice_addr = alice.account_id().clone().into();
let hans = pair_signer(Pair::generate().0);
let hans_address = hans.account_id().clone().into();
let cxt = test_context().await;
let ctx = test_context().await;
cxt.api
ctx.api
.tx()
.balances()
.transfer(hans_address, 100_000_000_000_000_000)
@@ -167,7 +167,7 @@ async fn transfer_error() {
.await
.unwrap();
let res = cxt
let res = ctx
.api
.tx()
.balances()
@@ -178,10 +178,9 @@ async fn transfer_error() {
.wait_for_finalized_success()
.await;
if let Err(Error::Runtime(err)) = res {
let details = err.inner().details().unwrap();
assert_eq!(details.pallet, "Balances");
assert_eq!(details.error, "InsufficientBalance");
if let Err(Error::Module(err)) = res {
assert_eq!(err.pallet, "Balances");
assert_eq!(err.error, "InsufficientBalance");
} else {
panic!("expected a runtime module error");
}