W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2012

Re: Should Exceptions be Errors in the ECMAScript bindings?

From: Allen Wirfs-Brock <allen@wirfs-brock.com>
Date: Wed, 18 Apr 2012 12:33:37 -0700
Cc: Erik Arvidsson <arv@chromium.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-Id: <7ADFACA9-799E-4599-A436-037E3A95C321@wirfs-brock.com>
To: Travis Leithead <Travis.Leithead@microsoft.com>

On Apr 18, 2012, at 12:09 PM, Travis Leithead wrote:

>> -----Original Message-----
>> From: arv@google.com [mailto:arv@google.com] On Behalf Of Erik Arvidsson
>> I assume this has been covered before but I could not find any
>> previous discussion.
>> Would it make sense to make DOM exceptions be Error objects in the
>> ECMAScript bindings? The reason this came up (again) is that some
>> engines provide stack traces on Error objects and developers also want
>> this on DOMExceptions. If DOMExceptions where real Errors engines
>> would get that feature for "free".
> I believe that WebIDL currently requires that DOM exceptions inherit from the ES "Error" prototype. This effectively makes them Errors for most purposes.

In ECMAScript, prototype chain inheritance does not establish a deep semantic "is-a" relationship. In particular,
     var foo=Object.create(Error.prototype)
does not give foo any special Error object internal semantic state or behavior (eg, implementation specific stack trace semantics).

Received on Wednesday, 18 April 2012 19:34:14 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:06 UTC