commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From S├ębastien Brisard <>
Subject [math] Consistent use of ExceptionContext [was "using the ExceptionContext facility"]
Date Fri, 26 Aug 2011 03:47:30 GMT
a while ago, I started a thread on the "proper" of keys in
ExceptionContext. This message was too vague, and raised very (very)
little interest. Hope this one will be more successful... I now have a
suggestion, which would work in at least some cases.

Very briefly, the issue is the following: the key names are attributed
by the method which throws the exception (say iThrowTheException()).
Now, the problem is: how does the method which catches the exception
(say iCatchTheException()) make sense out of this key name? The answer
would be to document the key names in the javadoc of
iThrowTheException(). While very flexible this approach does not
guarantee a minimum level of consistency.

In some cases though, the potential context of a specific exception is
known beforehand. For example, in
o.a.c.m.linear.NonPositiveDefiniteLinearOperator, the context might be
the so-called offending operator and offending vector. Then, I propose
that key names be stored as public final static String and documented
*in the exception definition*. For example, in
NonPositiveDefiniteLinearOperator, we would have two constants
public final static String OPERATOR = "operator"
public final static String VECTOR = "vector"

Thanks for your comments!

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

View raw message