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

[guide] Rejections Should Be Errors should cater for DOMException #84

Closed
marcoscaceres opened this issue Dec 5, 2013 · 9 comments
Closed

Comments

@marcoscaceres
Copy link

The advice given in the error section is a bit problematic, as DOM recommends using DOMExceptions, which are not instances of ES Error :( I agree that we should Error instead, but there is a lot precedence for using DOMException on the platform.

@marcoscaceres
Copy link
Author

updated issue title.

@erights
Copy link
Collaborator

erights commented Dec 5, 2013

@marcoscaceres Where is this advice?

@domenic
Copy link
Owner

domenic commented Dec 5, 2013

Actually DOMException is instanceof Error; it's DOMError that's the problem. But yes, we should specifically tell people not to use DOMError, and instead to use DOMException.

@marcoscaceres
Copy link
Author

@erights it's not quite explicit in the spec, but basically: http://dom.spec.whatwg.org/#errors

@domenic see: http://dom.spec.whatwg.org/#domexception ... it does not extend Error.

@domenic
Copy link
Owner

domenic commented Dec 5, 2013

Oh poop. Well, in that case, neither DOMError nor DOMException is currently suitable for use with promises.

@domenic
Copy link
Owner

domenic commented Dec 5, 2013

/cc @annevk @sicking

@marcoscaceres
Copy link
Author

The test:

try{document.body.appendChild(document.body)}catch(e){ e instanceof Error }

Chrome: true
Firefox: false
Safari: true

@domenic domenic closed this as completed in 270ced1 Dec 8, 2013
@annevk
Copy link
Collaborator

annevk commented Dec 9, 2013

DOMException has problems, this is not one of them. DOMError is planned for removal.

@marcoscaceres
Copy link
Author

Yeah, turned out that WebIDL defines what the prototype is. It's still very messy the way it's defined and Anne filed a bug for this long ago. Sorry for the wild goose chase.

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

4 participants