geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: [Error handling] NullPointer or IllegalArgument?
Date Thu, 14 Aug 2003 17:17:48 GMT
Alex Blewitt wrote:

> Why bother? RuntimeException has an argument to pass in the exception 
> type to the superclass, in the form of a nested exception (accessed by 
> Throwable.getCause()).
> 
> By your reasoning, every different subtype would have its own class:
> IORuntimeException
> TextRuntimeException
> SQLRuntimeException
>  :
> 
> I've only got one:
> 
> RuntimeException
> 
> :-)

Clarity.  For the same reason that you complained about not being able
to differentiate between an NPE thrown by the system and one thrown by
our code.  You can't differentiate a RuntimeException that holds an
IOException and one that holds a SQLException if all you use are
RuntimeExceptions.

New exception types don't need to all be thought up in advance.  You can
create them as you find you have need.

-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


Mime
View raw message