Skip to content

Conversation

simonprev
Copy link
Contributor

Got an argument error that I think could be more helpful:

 ** (ArgumentError) unsupported time unit. Expected :second, :millisecond, :microsecond, :nanosecond, or a positive integer, got "day"
     code: DateTime.add(DateTime.utc_now(), -1, "day")

I expected to have all the supported time unit in the error. Since the error comes from System.convert_time_unit, I simply added a conditional that raise a new error.

@josevalim josevalim merged commit d587593 into elixir-lang:main Sep 23, 2022
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@simonprev simonprev deleted the feature/complete-argument-error-datetime-add branch September 23, 2022 17:37
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