W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2012

Re: [DOM4] Constructor for DOMException?

From: Cameron McCormack <cam@mcc.id.au>
Date: Wed, 22 Feb 2012 10:00:24 +1100
Message-ID: <4F442208.2050303@mcc.id.au>
To: Marcos Caceres <marcosscaceres@gmail.com>
CC: public-webapps <public-webapps@w3.org>
Marcos Caceres:
> So… given that one can fake create a DOMException, and unless there
> is a valid reason not to allow this that I don't know of…. It would
> be nice if DOMException just defined a public constructor. This would
> allow clean prototyping of various APIs in ECMAScript (and give us
> poor saps who don't know C a chance to implement some Web APIs :) ).

Web IDL already requires exception interface objects like DOMException 
to be constructable, due to this:


and them being Function objects.  The constructor should take a single 
argument which is the message.  The name property will automatically be 
set to "DOMException", but you can overwrite this once you've created 
the object.  This is how the built in "throw an exception" algorithm works:

Received on Tuesday, 21 February 2012 23:01:05 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:38 UTC