You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Luc Maisonobe <Lu...@free.fr> on 2011/01/15 21:36:48 UTC

creating internal errors

Hi all,

With the exception refactoring, MathRuntimeException has been deprecated
in branch 2.X (but it is neither deprecated nor deleted in trunk for now
...).

This class did include a createInternalError static method that is
useful in defensive programming for difficult cases. It is used at 4
different places in branch 2.X and could be used in other places too (I
generally place one such thing in the default statement of a switch case
when all cases are known to be handled, as a security layer for later
changes in the number of cases).

So I propose to add a dedicated exception for this feature, probably
inheriting from MathIllegalStateException.

Any thoughts ?
Luc

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


[math] Re: creating internal errors

Posted by Phil Steitz <ph...@gmail.com>.
On Sat, Jan 15, 2011 at 3:36 PM, Luc Maisonobe <Lu...@free.fr> wrote:
> Hi all,
>
> With the exception refactoring, MathRuntimeException has been deprecated
> in branch 2.X (but it is neither deprecated nor deleted in trunk for now
> ...).
>
> This class did include a createInternalError static method that is
> useful in defensive programming for difficult cases. It is used at 4
> different places in branch 2.X and could be used in other places too (I
> generally place one such thing in the default statement of a switch case
> when all cases are known to be handled, as a security layer for later
> changes in the number of cases).
>
> So I propose to add a dedicated exception for this feature, probably
> inheriting from MathIllegalStateException.
>
> Any thoughts ?

Need to be careful not to over-use, backsliding into "the old ways" ;)
 but I am fine with this and see MathIllegalStateException as the
right abstraction for the kinds of uses in the 2.x code.

Phil
> Luc
>
> ---------------------------------------------------------------------
> 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