commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <>
Subject Re: [all][math] Help wanted with exceptions API design
Date Wed, 02 Feb 2011 11:06:10 GMT

> > [...]
> > 
> > Do I understand correctly that, if we go down that road, there would only
> > be a single exception (every failure will raise the same exception)?
> No, not at all, but your exceptions would provide all the same mechanism to 
> add valuable information up the stack. Have a look at the implementation of 
> ContextException and ContextRuntimeException. It's quite hollow, the real 
> code is in DefaultExceptionContext i.e. you could easily create also a 
> IllegalArgumentContectException derived from IllegalArgumentException. And 
> since the ExceptionContext is only an interface you might even replace ther 
> DefaultExceptionContext with something like LOcalizedExceptionContext that 
> has additional language support.
> > If the aim is only for printing the whole context, it is indeed very
> > flexible (adding a lot of info is easy). But if the caller wants to trap
> > and act on a particular condition (a part of the context), isn't it more
> > difficult than catching a specific exception?
> As I said, keep the hierarchy, but you might be able to trim it down more 
> easily, because you don't have to invent a new one simply because you want 
> to provide an additional information.

Ah, maybe that I see a use-case in CM: the 3 exceptions "DimensionMismatch",
"MultiDimensionMismatchException" and "MatrixDimensionMismatch" might be
trimmed to a single one.
However, the other problem which I'm still suspecting is that ther wouldn't
be specific accessors anymore like we have now in "MatrixDimensionMismatch":

> > [...]

Thanks for the clarification,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message