Hi,
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!
Sébastien

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

Reply via email to