W3C home > Mailing lists > Public > www-dom@w3.org > July to September 1998

Comments on the use of exceptions...

From: ANOQ of the Sun <anoq@vip.cybercity.dk>
Date: Thu, 20 Aug 1998 20:47:51 +0200
Message-ID: <35DC6F57.DE677B98@vip.cybercity.dk>
To: DOM List <www-dom@w3.org>


I was wondering why the method index in NamedNodeMap doesn't raise
an exception when the index is out of bounds... I believe that
this is an exceptional condition, which should not occur,
unless there's a bug in the DOM-client's code.


What happens if there's no more memory for the
array to hold the new item? I believe that an
out-of memory exception would be required here.


Same as above... out of memory exception?

I belive that there are more of such cases, but I have just
mentioned these examples. I have the opinion, that if
exceptions are used, they should be used everywhere
where an exceptional condition can arise. Otherwise
it is an indication that exceptions are not used
properly and consistently.

The only problem with out-of-memory exceptions is
if it needs memory to be thrown...

Fear the worst!
I just want to note, that when using CORBA, every
exception that is to be thrown in an out-of-process
call must be specified in IDL. If not, a good ORB
will throw an UNKNOWN exception, and a bad ORB will
not throw anything, and might even crash!

And in the case of an UNKNOWN exception, imagine
this dialog-box displayed to the user:
"error ocurred for reasons unknown"...

Not excactly an error-message suitable for
software which is to be taken seriously...


ANOQ of the Sun / Johnny Andersen

E-Mail:   anoq@vip.cybercity.dk or anoq@berlin-consortium.org
Homepage: http://users.cybercity.dk/~ccc25861/
Received on Thursday, 20 August 1998 15:10:28 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:04 UTC