From 3651aa3116a27a0d20db85264ab03c2d8a34341d Mon Sep 17 00:00:00 2001 From: salman01zp Date: Wed, 15 Nov 2023 14:33:30 +0530 Subject: [PATCH] convert DispatchErrorWithPostInfo to DispatchError --- pallets/roles/src/lib.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pallets/roles/src/lib.rs b/pallets/roles/src/lib.rs index e32ff9cba..ad643a145 100644 --- a/pallets/roles/src/lib.rs +++ b/pallets/roles/src/lib.rs @@ -267,8 +267,7 @@ pub mod pallet { ensure!(!AccountRolesMapping::::contains_key(&account), Error::::HasRoleAssigned); // chill - let _ = pallet_staking::Pallet::::chill(origin); - Ok(()) + pallet_staking::Pallet::::chill(origin) } /// Unbound funds from the stash account. @@ -296,9 +295,11 @@ pub mod pallet { ensure!(!AccountRolesMapping::::contains_key(&account), Error::::HasRoleAssigned); // Unbound funds. - let _ = pallet_staking::Pallet::::unbond(origin, amount); - - Ok(()) + let res = pallet_staking::Pallet::::unbond(origin, amount); + match res { + Ok(_) => Ok(()), + Err(dispatch_post_info) => Err(dispatch_post_info.error), + } } /// Withdraw unbound funds after un-bonding period has passed. @@ -320,9 +321,11 @@ pub mod pallet { ); // Withdraw unbound funds. - let _ = pallet_staking::Pallet::::withdraw_unbonded(origin, 0); - - Ok(()) + let res = pallet_staking::Pallet::::withdraw_unbonded(origin, 0); + match res { + Ok(_) => Ok(()), + Err(dispatch_post_info) => Err(dispatch_post_info.error), + } } } }