commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Caswell <steven.casw...@gmail.com>
Subject Re: [lang] ExceptionUtils methods
Date Wed, 16 Nov 2005 02:41:19 GMT
I like these suggestions for method naming.

On 11/13/05, Gary Gregory <ggregory@seagullsoftware.com> wrote:
> 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
>
>


--
Steven Caswell
steven.caswell@gmail.com

(c) 404-693-4148
(o) 404-260-2382

Take back the web - http://www.mozilla.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