[DOM4] Constructor for DOMException?

2012-02-21 Thread Marcos Caceres
Hi, I'm currently trying to implement a spec using ECMAScript. Unfortunately, I have a bunch of DOMExceptions that can't be thrown cleanly because there is no way to instantiate a DOMException through ECMAScript (new DOMException(...) returns a "TypeError: Illegal constructor" in browsers).

Re: [DOM4] Constructor for DOMException?

2012-02-21 Thread Cameron McCormack
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 sap

Re: [DOM4] Constructor for DOMException?

2012-02-22 Thread João Eiras
On Wed, 22 Feb 2012 00:00:24 +0100, Cameron McCormack wrote: 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 cle

Re: [DOM4] Constructor for DOMException?

2012-02-22 Thread Anne van Kesteren
On Wed, 22 Feb 2012 15:27:41 +0100, João Eiras wrote: On Wed, 22 Feb 2012 00:00:24 +0100, Cameron McCormack wrote: Web IDL already requires exception interface objects like DOMException to be constructable, due to this: http://dev.w3.org/2006/webapi/WebIDL/#es-exception-call and them b

Re: [DOM4] Constructor for DOMException?

2012-02-22 Thread Cameron McCormack
João Eiras: DOMExceptions have both a code and a message. Perhaps the constructor should be extended to include both. Anne van Kesteren: code is legacy, but name would be good to expose. The constructor has the same signature as the standard ECMAScript Error constructors, so we are being co

Re: [DOM4] Constructor for DOMException?

2012-02-23 Thread João Eiras
On Thu, 23 Feb 2012 00:57:54 +0100, Cameron McCormack wrote: João Eiras: DOMExceptions have both a code and a message. Perhaps the constructor should be extended to include both. Anne van Kesteren: code is legacy, but name would be good to expose. The constructor has the same signature