Closed marcoscaceres closed 10 years ago
updated issue title.
@marcoscaceres Where is this advice?
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.
@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.
Oh poop. Well, in that case, neither DOMError nor DOMException is currently suitable for use with promises.
/cc @annevk @sicking
The test:
try{document.body.appendChild(document.body)}catch(e){ e instanceof Error }
Chrome: true Firefox: false Safari: true
DOMException has problems, this is not one of them. DOMError is planned for removal.
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.
The advice given in the error section is a bit problematic, as DOM recommends using
DOMException
s, which are not instances of ES Error :( I agree that we should Error instead, but there is a lot precedence for usingDOMException
on the platform.