Skip to content

bad-number-2531-fix - #2669

Open
esdorman wants to merge 1 commit into
liberapay:masterfrom
esdorman:fix/bad-number-2531
Open

bad-number-2531-fix#2669
esdorman wants to merge 1 commit into
liberapay:masterfrom
esdorman:fix/bad-number-2531

Conversation

@esdorman

@esdorman esdorman commented Dec 8, 2025

Copy link
Copy Markdown

Closes #2531

This patch addresses an issue where input amounts with excessive decimal precision (e.g., '0.833') resulted in a generic, confusing "X is not a valid number" error.

Changes

  1. Added TooManyDecimalPlaces Exception: Defined a specific TooManyDecimalPlaces exception in liberapay/exceptions.py.
  2. Updated parse_money_amount: Modified the logic in liberapay/i18n/base.py to raise this new, specific exception when money.amount != decimal.

This ensures that users receive a clear error message explaining the precision issue, aligning with the maintainer's request to "improve the error message" instead of allowing ambiguous number validation failures.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Bad request "0.833" is not a number

1 participant