Skip to content

Commit

Permalink
convert DispatchErrorWithPostInfo to DispatchError
Browse files Browse the repository at this point in the history
  • Loading branch information
salman01zp committed Nov 15, 2023
1 parent 2dfe702 commit 3651aa3
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions pallets/roles/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@ pub mod pallet {
ensure!(!AccountRolesMapping::<T>::contains_key(&account), Error::<T>::HasRoleAssigned);

// chill
let _ = pallet_staking::Pallet::<T>::chill(origin);
Ok(())
pallet_staking::Pallet::<T>::chill(origin)
}

/// Unbound funds from the stash account.
Expand Down Expand Up @@ -296,9 +295,11 @@ pub mod pallet {
ensure!(!AccountRolesMapping::<T>::contains_key(&account), Error::<T>::HasRoleAssigned);

// Unbound funds.
let _ = pallet_staking::Pallet::<T>::unbond(origin, amount);

Ok(())
let res = pallet_staking::Pallet::<T>::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.
Expand All @@ -320,9 +321,11 @@ pub mod pallet {
);

// Withdraw unbound funds.
let _ = pallet_staking::Pallet::<T>::withdraw_unbonded(origin, 0);

Ok(())
let res = pallet_staking::Pallet::<T>::withdraw_unbonded(origin, 0);
match res {
Ok(_) => Ok(()),
Err(dispatch_post_info) => Err(dispatch_post_info.error),
}
}
}
}

0 comments on commit 3651aa3

Please sign in to comment.