Skip to content

Is it an error to pass a bad option to a function? #738

Closed
@catamorphism

Description

@catamorphism

I was looking at the following test case in https://github.com/unicode-org/message-format-wg/blob/main/test/test-functions.json :

{
      "src": ".input {$foo :number minimumFractionDigits=foo} {{bar {$foo}}}",
      "params": { "foo": 4.2 },
      "exp": "bar {$foo}",
      "errors": [{ "type": "bad-option" }]
    },

This means that the message ".input {$foo :number minimumFractionDigits=foo} {{bar {$foo}}}" is supposed to trigger an error because the string "foo" can't be parsed as an integer.

However, there is no error in errors.md that corresponds to "bad-option" in the test description. Should there be one? It's not really covered by "invalid expression error" (or at least I don't think so); it's definitely not covered by "Operand Mismatch Error" since the description of that error only refers to the function's operand and not its options.

If this is really an error, I think there should be a separate "Option Mismatch Error" to go with "Operand Mismatch Error".

See #706 for the general issue to create a list of error names that can be used in spec tests. I thought this should be a separate issue since the registry spec doesn't say much about error handling for bad option values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    LDML46LDML46 Release (Tech Preview - October 2024)blocker-candidateThe submitter thinks this might be a block for the next releaseerrorsIssues related to the errors section of the spec

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions