diff --git a/pallets/loans/src/entities/loans.rs b/pallets/loans/src/entities/loans.rs index a0cc2322ca..2deabecc8a 100644 --- a/pallets/loans/src/entities/loans.rs +++ b/pallets/loans/src/entities/loans.rs @@ -370,7 +370,7 @@ impl ActiveLoan { ensure!( self.total_repaid.effective()? >= expected_payment, - DispatchError::Other("payment overdue") + Error::::from(BorrowLoanError::PaymentOverdue) ); Ok(()) diff --git a/pallets/loans/src/tests/borrow_loan.rs b/pallets/loans/src/tests/borrow_loan.rs index 90645656ee..fcaa8d7a16 100644 --- a/pallets/loans/src/tests/borrow_loan.rs +++ b/pallets/loans/src/tests/borrow_loan.rs @@ -734,7 +734,7 @@ mod cashflow { loan_id, PrincipalInput::Internal(COLLATERAL_VALUE / 4) ), - DispatchError::Other("payment overdue") + Error::::from(BorrowLoanError::PaymentOverdue) ); }); } diff --git a/pallets/loans/src/types/mod.rs b/pallets/loans/src/types/mod.rs index ee9def50ed..2d279fb9e9 100644 --- a/pallets/loans/src/types/mod.rs +++ b/pallets/loans/src/types/mod.rs @@ -44,6 +44,8 @@ pub enum BorrowLoanError { Restriction, /// Emits when maturity has passed and borrower tried to borrow more MaturityDatePassed, + /// Emits when the cashflow payment is overdue + PaymentOverdue, } /// Error related to loan borrowing