Skip to content

modBy runtime error when passing 0 as an argument #1147

Open
@glensargent

Description

@glensargent

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions