Migrate membership, nicks, scored-pool and session to decl_error (#4463)

* Migrate membership, nicks, scored-pool and session to decl_error

* Fix tests

* Update frame/scored-pool/src/tests.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>

* Remove InsufficientBalance error from scored-pool

* Replace Error::<Test, DefaultInstance> with Error::<Test, _>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Stanislav Tkach
2019-12-20 18:12:21 +02:00
committed by Shawn Tabrizi
parent 9950ea98fc
commit 328563f8d4
7 changed files with 115 additions and 81 deletions
+1 -4
View File
@@ -794,8 +794,6 @@ decl_error! {
AlreadyBonded,
/// Controller is already paired.
AlreadyPaired,
/// Should be the root origin or the `T::SlashCancelOrigin`.
BadOrigin,
/// Targets cannot be empty.
EmptyTargets,
/// Duplicate index.
@@ -1190,8 +1188,7 @@ decl_module! {
fn cancel_deferred_slash(origin, era: EraIndex, slash_indices: Vec<u32>) {
T::SlashCancelOrigin::try_origin(origin)
.map(|_| ())
.or_else(ensure_root)
.map_err(|_| Error::<T>::BadOrigin)?;
.or_else(ensure_root)?;
let mut slash_indices = slash_indices;
slash_indices.sort_unstable();