Re: Exceptions for DOM-XPath

On Tue, 10 Apr 2012 21:30:02 +0200, Jonas Sicking <jonas@sicking.cc> wrote:
> We're currently cleaning out some of our error handling code and the
> turn has come to XPathException. The DOM4+WebIDL specs has created a
> nice set of exceptions which make it easier for authors to check for
> specific exceptions. You now only have to check .name (which is a
> string) rather than .code (which is a "magic" number) and which
> interface it implements (DOMException vs. Error vs. XPathException
> etc).
>
> So our plan is to for INVALID_EXPRESSION_ERR throw a "SyntaxError"
> (I.e. a DOMException) and for TYPE_ERR throw a plain JS TypeError.
>
> Unfortunately the DOM-XPath spec is no longer being maintained so
> there is noone to issue an Errata, but if this change sounds good to
> everyone we'll just update our documentation which should hopefully be
> enough to get authors aware.

I (and others) maintain errata here for now:  
http://wiki.whatwg.org/wiki/DOM_XPath

I guess we should also figure out how to deal with Attr nodes -> Attr  
objects.


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Tuesday, 10 April 2012 19:38:59 UTC