Skip to content

Improve error messages for enums inside dictionaries #204

Open
@domenic

Description

@domenic

Currently, converting { type: "asdf" } to a dictionary defined as follows

dictionary UnderlyingSource {
  ReadableStreamType type;
};

enum ReadableStreamType { "bytes" };

will produce an error message like

The provided value has member 'type' that 'asdf' is not a valid enumeration value for ReadableStreamType

which is not grammatical. This arises because of how we compose our dictionary error message and enum error message.

Note that just trying to convert "asdf" to ReadableStreamType would produce something like

The provided value 'asdf' is not a valid enumeration value for ReadableStreamType

Here are some thoughts:

  • Is it a good idea to mention enum names in error messages at all? They're not web-developer-facing, so maybe they should just be omitted, both in dictionaries and outside.
  • If we were to keep it, some ideas:
    • 'asdf' is not a valid enumeration value for ReadableStreamType (provided as the 'type' member of the provided value)

    • 'asdf' is not a valid ReadableStreamType enumeration value for the 'type' member of the provided value

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