Skip to content

fix: validation.rs require_positive_amount should panic with a message that includes the actual amount #829

Description

@BigBen-7

Description

require_positive_amount(e, amount) panics with "amount must be positive". The message does not include the actual invalid amount, making debugging harder.

What to fix

pub fn require_positive_amount(amount: i128) {
    if amount <= 0 {
        panic!("InvalidAmount: amount must be positive, got {}", amount);
    }
}

Update any tests that match on the old message string.

Files touched

  • src/validation.rs
  • Any test files matching the old panic string

PR requirement

  • Closes #[issue_id] — Timeframe: 24 hours

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixCorrectness fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions