Only return an error if the extrinsic failed. (#156)

This commit is contained in:
David Craven
2020-09-01 10:15:04 +00:00
committed by GitHub
parent 3ea9d3b8bb
commit e9c50e21d0
5 changed files with 76 additions and 35 deletions
+3 -2
View File
@@ -112,6 +112,7 @@ mod tests {
use crate::{
error::{
Error,
ModuleError,
RuntimeError,
},
events::EventsDecoder,
@@ -193,8 +194,8 @@ mod tests {
let res = client
.transfer_and_watch(&hans, alice.account_id(), 100_000_000_000)
.await;
if let Err(Error::Runtime(error)) = res {
let error2 = RuntimeError {
if let Err(Error::Runtime(RuntimeError::Module(error))) = res {
let error2 = ModuleError {
module: "Balances".into(),
error: "InsufficientBalance".into(),
};
+5 -2
View File
@@ -43,7 +43,10 @@ pub struct SudoCall<'a, T: Sudo> {
mod tests {
use super::*;
use crate::{
error::Error,
error::{
Error,
RuntimeError,
},
extrinsic::PairSigner,
frame::balances::TransferCall,
tests::{
@@ -68,7 +71,7 @@ mod tests {
let res = client.sudo_and_watch(&alice, &call).await;
assert!(
if let Err(Error::BadOrigin) = res {
if let Err(Error::Runtime(RuntimeError::BadOrigin)) = res {
true
} else {
false