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

Provide guidance on what to throw? #396

Open
marcoscaceres opened this issue Jul 17, 2020 · 2 comments
Open

Provide guidance on what to throw? #396

marcoscaceres opened this issue Jul 17, 2020 · 2 comments

Comments

@marcoscaceres
Copy link
Member

I'm wonder if the spec should provide some guidance on kind of DOM exception should be thrown?... we've got specs throwing:

  • NotAllowedError (web share)
  • SecurityError (Geolocation, Gamepad)
  • Possibly others...
@clelland
Copy link
Collaborator

For existing features where policy control is being retrofitted, the current guidance (in integration.md) is

Existing web platform features which already have some mechanism for reporting errors, or signalling that the user chose not to grant permission, should use those existing mechanisms when disabled.

The goal there being to not break existing content by introducing a new failure mode, but instead have policy violations caught by existing error-handling code.

For new APIs, it's a different situation, for sure. We could provide some guidance, probably for both exception-based and promise-based APIs.

@marcoscaceres
Copy link
Member Author

We could provide some guidance, probably for both exception-based and promise-based APIs.

That would be great. Personally, NotAllowedError in both cases would be fine:

[=throw=] a {{"NotAllowedError"}}` {{DOMException}}.

And:

Return [=a promise rejected with=] a {{"NotAllowedError"}} {{DOMException}}.

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

2 participants