commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory" <ggreg...@seagullsoftware.com>
Subject RE: [lang] ExceptionUtils methods
Date Mon, 14 Nov 2005 01:04:03 GMT
Hello:

I am wondering if a "toXXX" name is not more appropriate since you are
converting rather than getting:

ExceptionUtils.toMessageNoStackTrace(ex)

Or simply:

ExceptionUtils.toMessage(ex)

Also, I wonder if 'Short' is really useful, if I give it 1000 lines,
it's not short. I think you just omit the bias issue by calling it:

ExceptionUtils.toMessage (ex, stackFrameCount)

Here, a descriptive parameter name like stackFrameCount avoids the need
to have a more complicated API name.

Gary


> -----Original Message-----
> From: Stephen Colebourne [mailto:scolebourne@btopenworld.com]
> Sent: Saturday, November 12, 2005 4:02 AM
> To: Jakarta Commons Developers List
> Subject: [lang] ExceptionUtils methods
> 
> Could I propose some new methods for ExceptionUtils:
> 
> - ExceptionUtils.getLogMessageNoStackTrace(ex)
> 
> Returns a string of the form:
> IllegalArgumentException: Person must have a surname
> <ClassNameNoPackage>: <Message>
> 
> - ExceptionUtils.getLogMessageShortStackTrace(ex, lines)
> 
> Returns the same as above but with a short stack trace, eg for 2
lines:
> IllegalArgumentException: Person must have a surname
>   at org.apache.program.ValidatePerson.validate()
>   at org.apache.program.Validator.validate()
> 
> Potentially a variation on this could filter out certain stack trace
> lines.
> 
> 
> All code would be carefully null protected and designed for log
> messages. I think this is useful, but maybe it should form part of the
> logging tool (as well!)?
> 
> Stephen
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 


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


Mime
View raw message