geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Wilkins <gr...@mortbay.com>
Subject Re: [Error handling] NullPointer or IllegalArgument?
Date Thu, 14 Aug 2003 12:34:39 GMT



Jason Dillon wrote:
>> [Exception] IllegalArgumentException: address must not be null
> 
> 
> +1
> 
> org.apache.geronimo.common.NullArgumentException extends IAE and handles 
> the formatting of the message too, so you can:
> 
> throw new NullArgumentException("address");

I will only +1 the NullArgumentException if it is part of internationalizing
our Exception.  So that NullArgumentException can print out:

   NullArgumentException: address mosto non essere null

etc.

Other than that - I often find that subclassing exceptions just
results it too extra hassle when too often most try blocks
end with catch(Exception e) and you may as well just have
one Exception type:

   class ShitHappenedException extends Exception


But I think subclassing exceptions is good, if it is to
add functionality about throwing the exception (rather than catching it).

cheers



Mime
View raw message