Skip to content

feat(loan_manager): add repayment below minimum error handling and up…#37

Open
BigJohn-dev wants to merge 1 commit into
LabsCrypt:mainfrom
BigJohn-dev:LoanManager-uses-raw-panics-for-user-facing-failures-instead-of-typed-LoanError-returns
Open

feat(loan_manager): add repayment below minimum error handling and up…#37
BigJohn-dev wants to merge 1 commit into
LabsCrypt:mainfrom
BigJohn-dev:LoanManager-uses-raw-panics-for-user-facing-failures-instead-of-typed-LoanError-returns

Conversation

@BigJohn-dev

Copy link
Copy Markdown

Closes #8

✅ Requested error handling updates are in place

I updated the contracts so the user-facing cases now return typed errors instead of panicking:

  • In lib.rs, repay now returns LoanError::RepaymentBelowMinimum for partial repayments that fall below the configured floor.
  • In lib.rs, set_min_repayment_amount now returns LoanError::InvalidAmount for negative input instead of panicking.
  • The underflow path in adjust_total_outstanding is still a panic, but it is now documented as an internal invariant that should be unreachable from normal inputs.
  • In lib.rs, cooldown enforcement now returns PoolError::WithdrawalCooldownActive instead of panicking.
  • The related assertions were updated in test.rs and test.rs.

I also checked editor diagnostics afterward, and there are no reported Rust errors in the touched files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Contracts] LoanManager uses raw panics for user-facing failures instead of typed LoanError returns

1 participant