commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <GGreg...@seagullsoftware.com>
Subject RE: [all][math] Help wanted with exceptions API design
Date Tue, 01 Feb 2011 23:27:26 GMT
> -----Original Message-----
> From: Gilles Sadowski [mailto:gilles@harfang.homelinux.org]
> Sent: Tuesday, February 01, 2011 18:16
> To: dev@commons.apache.org
> Subject: Re: [all][math] Help wanted with exceptions API design
> 
> > > > > The currently defined exceptions in [math] can be found in the
> > > > > top-level package and .exceptions.  Those in the top-level have
at
> > > > > this point been deprecated.
> >
> > Don't package your exceptions in a package called ".exceptions". That is
> very odd.
> 
> Why?
> 
> > The exception should be defined where they are used.
> 
> What do you do for exceptions that are used in several classes and several
> packages?

Here is a probably too simple example: 

com.example defines IOException
com.example.input uses IOException
com.example.output uses IOException

> 
> > As I and others have suggested: reuse existing stock exceptions. Only
> create exceptions classes if you must.
> 
> Depending on the requirements, the exceptions we created may be more
> convenient.
> 
> > If you consider creating an exception, especially in a hierarchy, think:
> why would I want to CATCH this exception as opposed to a superclass?
> 
> I don't agree because I don't consider from that stand-point. IMHO, the
> exception is useful if it conveys a problem as specifically as possible.
> The caller is free to catch, or not, whatever he likes.
> 
> 
> Best,
> Gilles
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message