[Bug 14887] Prototype of exception interface objects is Object.prototype in implementations, not Error.prototype


--- Comment #2 from Aryeh Gregor <ayg@aryeh.name> 2011-11-21 19:41:31 UTC ---
Sorry if I wasn't clear.  In browsers, DOMException inherits from Object in the
prototype chain, not Error.  Thus there's no .message inherited from Error. 
Likewise, there's no .toString inherited from Error -- it's inherited from
Object, which has a different .toString:

Object.prototype.toString: http://es5.github.com/#x15.2.4.2
Error.prototype.toString: http://es5.github.com/#x15.11.4.4

So I see two possibilities:

1) This bug is closed WONTFIX.  The spec is left as-is, which contradicts all
browsers, and browsers are asked to change.  I'm fine with this, but only if
browsers are actually willing to change.

2) The spec is changed to say that exception types like DOMException inherit
from Object rather than Error, to match browsers.  In this case, the spec needs
to require that .toString and possibly .message be defined on all exception
interface prototype objects, because they will no longer be inherited from
Error, and the ones inherited from Object don't behave in the expected fashion
({}.toString() on a DOMException gives "[object DOMException]" instead of the

Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Received on Monday, 21 November 2011 19:41:38 UTC