W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2012

Exceptions for DOM-XPath

From: Jonas Sicking <jonas@sicking.cc>
Date: Tue, 10 Apr 2012 12:30:02 -0700
Message-ID: <CA+c2ei8VmKwDqvU2Ad8cMA3+hkA9D1VujciTR4cgiXa8kiGESg@mail.gmail.com>
To: Webapps WG <public-webapps@w3.org>
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

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:33 UTC