W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2011

[DOM3Events] Exceptions

From: Anne van Kesteren <annevk@opera.com>
Date: Fri, 04 Mar 2011 15:52:46 +0100
To: www-dom@w3.org
Message-ID: <op.vrtp98l464w2qv@anne-van-kesterens-macbook-pro.local>
I removed EventException from DOM Core and I think that change makes  
sense. We use DOMException for most of our APIs. Only dispatchEvent()  
throws exceptions of this type and it seems like unneeded complexity to me.

DOM Level 3 Events says dispatchEvent() can throw these exceptions:  
EventException.UNSPECIFIED_EVENT_TYPE_ERR,  
EventException.DISPATCH_REQUEST_ERR, DOMException.NOT_SUPPORTED_ERR, and  
DOMException.INVALID_CHARACTER_ERR.

I have not been able to get implementations to throw any of the latter two  
exceptions. Examples would be most welcome. In fact the text for  
INVALID_CHARACTER_ERR seems to overlap with UNSPECIFIED_EVENT_TYPE_ERR as  
they are both talking about restrictions on Event.type. However, what the  
restrictions on Event.type are is not at all clear. Event.type only says  
that no events should be created that contain whitespace. It does not say  
anything about the empty string, or whether initializing events with  
whitespace in their type will throw an error or not (either then or later).

I do not think we need UNSPECIFIED_EVENT_TYPE_ERR at all really. Why  
should we require invoking initEvent()?

And DISPATCH_REQUEST_ERR could easily be replaced by INVALID_STATE_ERR. We  
use it that way in tons of APIs.


-- 
Anne van Kesteren
http://annevankesteren.nl/
Received on Friday, 4 March 2011 14:53:21 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:07 GMT