commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <simonetrip...@apache.org>
Subject Re: [BeanUtils2] Some proposals for an exception name
Date Tue, 19 Jun 2012 12:16:52 GMT
>>>> A suggestion:
>>>>
>>>> we are often using the String.format() method to format Exception
>>>> messages - which is very good, IMHO - and since we are introducing a
>>>> new Exception we can take advantage for reducing its use, centralizing
>>>> the message format in the new exception itself, have a look at the
>>>> Digester's ErrorMessage <http://s.apache.org/wiR>
>
> A better approach is IMHO the Contexted(Runtime)Exception of the
> oac.lang3.exception package. Instead of writing a prose for the message
> text, you can use a short informative statement and add all relevant
> additional information in a structured way with the possibility to be
> evaluated properly by a client. You may even enrich the information at
> higher levels by catching the exception, adding the info and rethrow it
> again.
>

I like the approach, thanks Jörg!!! I think we can reuse some ideas to
improve the BU2 Exceptions design.

Contexted(Runtime)Exception is good for multi purposes applications
and dynamic contexts, BU2 has already known contexts, i.e. in a
potential PropertyNotFoundException the context is identified by the
missing property in the target class, so BeanReflectionException could
become kind of Contexted(Runtime)Exception and
PropertyNotFoundException could just be

PropertyNotFoundException( String propertyName, Class<?> target,
Throwable cause )
{
    // impl here
}

best and thanks,
-Simo

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/

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


Mime
View raw message