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

Better error if Money#allocate called with an empty array #278

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

ghiculescu
Copy link
Contributor

At the moment if you do Money.new(1, "USD").allocate([]) it will raise with:

lib/money/allocator.rb:138:in `%': divided by 0 (ZeroDivisionError)

Since this is an invalid input, it's better to identify that and raise earlier with a more clear message.

@elfassy
Copy link
Contributor

elfassy commented Apr 5, 2024

please rebase if you'd like to get this PR merged

@ghiculescu
Copy link
Contributor Author

Done @elfassy

@elfassy elfassy merged commit 984a578 into Shopify:main Apr 10, 2024
5 checks passed
@ghiculescu ghiculescu deleted the allocate-none branch April 10, 2024 23:47
@elfassy elfassy mentioned this pull request Apr 17, 2024
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.

None yet

2 participants