Migrate generic-asset, identity and im-online to decl_error (#4473)

* Migrate generic-asset, identity and im-online to decl_error

* Update democracy tests

* Update nicks test
This commit is contained in:
Stanislav Tkach
2019-12-21 16:10:29 +02:00
committed by Shawn Tabrizi
parent f6cbf4421f
commit 2c2e0d772d
8 changed files with 153 additions and 77 deletions
+4 -4
View File
@@ -1002,13 +1002,13 @@ where
// ...yet is was alive before
&& old_balance >= T::ExistentialDeposit::get()
{
Err("payment would kill account")?
Err(Error::<T, I>::KeepAlive)?
}
Self::ensure_can_withdraw(who, value, reasons, new_balance)?;
Self::set_free_balance(who, new_balance);
Ok(NegativeImbalance::new(value))
} else {
Err("too few free funds in account")?
Err(Error::<T, I>::InsufficientBalance)?
}
}
@@ -1123,7 +1123,7 @@ where
fn reserve(who: &T::AccountId, value: Self::Balance) -> result::Result<(), DispatchError> {
let b = Self::free_balance(who);
if b < value {
Err("not enough free funds")?
Err(Error::<T, I>::InsufficientBalance)?
}
let new_balance = b - value;
Self::ensure_can_withdraw(who, value, WithdrawReason::Reserve.into(), new_balance)?;
@@ -1268,7 +1268,7 @@ where
starting_block: T::BlockNumber
) -> DispatchResult {
if <Vesting<T, I>>::exists(who) {
Err("A vesting schedule already exists for this account.")?
Err(Error::<T, I>::ExistingVestingSchedule)?
}
let vesting_schedule = VestingSchedule {
locked,