Comments on the use of exceptions...

Hello!


NamedNodeMap.index:

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.

NamedNodeMap.setNamedItem:

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.

Document.createXXX:

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...

Comments?


Cheers
-- 
,
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