Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error messages for enums inside dictionaries #204

Open
domenic opened this issue Apr 20, 2020 · 0 comments
Open

Improve error messages for enums inside dictionaries #204

domenic opened this issue Apr 20, 2020 · 0 comments

Comments

@domenic
Copy link
Member

domenic commented Apr 20, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant