Exceptions for DOM-XPath

Hi All,

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.

/ Jonas

Received on Tuesday, 10 April 2012 19:31:01 UTC