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

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