W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2011

[Bug 10623] Simplify Web IDL exceptions

From: <bugzilla@jessica.w3.org>
Date: Fri, 09 Sep 2011 12:30:49 +0000
To: public-script-coord@w3.org
Message-Id: <E1R20EL-0005hg-2X@jessica.w3.org>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=10623

--- Comment #14 from Cameron McCormack <cam@mcc.id.au> 2011-09-09 12:30:43 UTC ---
I've had another crack at exceptions.  There is no recommendation in the spec
now to create a hierarchy of exceptions.  Instead it recommends to use
DOMException for all new exception types, or to mint a new IDL exception only
if new exception fields are required.  IDL exceptions now conceptually have a
"type", which gets mapped on to the .name property in JS.  So you could say

  Throw a DOMException of type "FooBarError".

and that would result in a DOMException object whose .name == "FooBarError". 
You can not specify the type, in which case .name == "DOMException" (so the
name of the constructor is the .name of the exception, like the builtin JS
ones).

There's no IDL syntax for defining exception types like "FooBarError" above;
just do this in prose.

Jonas, Alex and I had some offlist discussions about whether we could do away
with DOMException altogether and just use Error.  I think some experiments were
going to be done to see if this is feasible.  I am happy for now using
DOMException.

Comments welcome.  Perhaps start a thread on public-script-coord if there are
issues with this approach.  I will declare this Last Call comment resolved at
this point, however.  Anne, please indicate whether this resolution is
satisfactory.

See the exact change here:

http://dev.w3.org/cvsweb/2006/webapi/WebIDL/Overview.html.diff?r1=1.397;r2=1.398;f=h

-- 
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 Friday, 9 September 2011 12:30:52 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:04 UTC