Introduce ModuleError struct (#10776)

* better partial eq impl

* introduce module error

* fmt

* import module error

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* fixes

* fmt

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Shawn Tabrizi
2022-02-03 14:02:45 +01:00
committed by GitHub
parent 99fae0cd57
commit 21d0cf0eea
9 changed files with 84 additions and 77 deletions
+6 -2
View File
@@ -29,7 +29,7 @@ use sp_io::{
hashing::{blake2_128, twox_128, twox_64},
TestExternalities,
};
use sp_runtime::DispatchError;
use sp_runtime::{DispatchError, ModuleError};
pub struct SomeType1;
impl From<SomeType1> for u64 {
@@ -654,7 +654,11 @@ fn error_expand() {
);
assert_eq!(
DispatchError::from(pallet::Error::<Runtime>::InsufficientProposersBalance),
DispatchError::Module { index: 1, error: 0, message: Some("InsufficientProposersBalance") },
DispatchError::Module(ModuleError {
index: 1,
error: 0,
message: Some("InsufficientProposersBalance")
}),
);
}