Skip to content

Conversation

@davydog187
Copy link
Contributor

As a follow up to #15027, provide a nicer error message when invoking Enum.count_until with an invalid limit

As a follow up to elixir-lang#15027, provide a nicer error message when invoking
`Enum.count_until` with an invalid limit
Comment on lines +783 to +784
def count_until(_enumerable, _limit) do
raise ArgumentError, "Enum.count_until/2 only accepts limits greater than 0"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def count_until(_enumerable, _limit) do
raise ArgumentError, "Enum.count_until/2 only accepts limits greater than 0"
def count_until(_enumerable, limit) when is_integer(limit) do
raise ArgumentError, "expected limit to be greater than 0, got: #{limit}"

Copy link
Member

Choose a reason for hiding this comment

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

Same below :)

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.

2 participants