Re: DOMException extends RuntimeException (DOM Java binding)

"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 UTC