Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecation notice and raise error when strings cannot be parsed by bigdecimal #307

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

TayKangSheng
Copy link
Contributor

@TayKangSheng TayKangSheng commented Jun 27, 2024

issue: #307

Why

Currently we attempt to parse strings with BigDecimal, and we default to BigDecimal(0) for cases where the string cannot be parsed. In v3, we want to remove this fallback and we recommend users to parse the money first before using initializing a new money object.

What

This is a breaking change

We now raise ArgumentError if the provided value is a string and cannot be parsed by BigDecimal.

Money.new("$1.00", "USD") # -> raises invalid value for BigDecimal(): "$1.00" (ArgumentError)

@elfassy elfassy added the v3 label Jun 28, 2024
Copy link
Contributor

@elfassy elfassy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last event in the logs was 4 weeks ago, we're good to merge this in v3!

@elfassy elfassy merged commit 10efdfb into v3 Aug 2, 2024
9 checks passed
@TayKangSheng TayKangSheng deleted the ks.remove-deprecation-coerce-money-string branch August 6, 2024 09:16
@elfassy elfassy mentioned this pull request Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants