W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2000

Re: DOMException extends RuntimeException (DOM Java binding)

From: Stephen R. Savitzky <steve@rsv.ricoh.com>
Date: 28 Apr 2000 09:21:26 -0700
To: <www-dom@w3.org>
Message-ID: <qcitx25h89.fsf@congo.crc.ricoh.com>
"Julian Reschke" <reschke@medicaldataservice.de> writes:

> I was wondering why DOMException extends RuntimeException... As far as I
> understand, this means that Java code calling the DOM does not have to catch
> these exceptions in order to compile. That doesn't seem to be very
> reasonable to me...

I would think that it's for much the same reason that things like
ArrayIndexOutOfBoundsException and NullPointerException extend
RuntimeException -- almost any program that uses the DOM is theoretically
capable of raising a DOMException, but this almost invariably indicates a
bug rather than an expected but unusual condition.  There's simply no good
reason to check for DOMException in most cases, because if you get one it
means you probably need to rewrite your program.

``Never check for an error condition you can't handle''

-- 
Stephen R. Savitzky  <steve@rsv.ricoh.com>  <http://rsv.ricoh.com/~steve/>
Platform for Information Applications:      <http://RiSource.org/PIA/>
Chief Software Scientist, Ricoh Silicon Valley, Inc. Calif. Research Center
 voice: 650.496.5710  front desk: 650.496.5700  fax: 650.854.8740 
  home: <steve@theStarport.org> URL: http://theStarport.org/people/steve/
Received on Friday, 28 April 2000 12:22:00 GMT

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