elm/core

modBy runtime error when passing 0 as an argument

Opened this issue · 1 comments

modBy takes any integer as an input and therefore it's possible (and quite frequent if you're running it on indexes) to attempt to divide by 0 which provides a runtime error:
image

The elm lsp/compiler provides no warning for this and it successfully compiles, which contradicts the 'no runtime exceptions' rule

Easy issue to replicate, just pass 0 in to modBy. I'm unsure if this is intentional behaviour or not but after a day of writing elm it caught me off guard to have my first runtime error

Thanks for reporting this! To set expectations:

  • Issues are reviewed in batches, so it can take some time to get a response.
  • Ask questions a community forum. You will get an answer quicker that way!
  • If you experience something similar, open a new issue. We like duplicates.

Finally, please be patient with the core team. They are trying their best with limited resources.