"Jim Barrows" <[EMAIL PROTECTED]> wrote on 09/09/2004 01:00:11 PM:
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, September 09, 2004 9:52 AM
> > To: Struts Users Mailing List
> > Subject: RE: Best practices for localization of exception messages
> >
> >
> >
> >
> >
> >
> > snip
> >
> >
> > > I'll catch an SQLException, put it in a DAOFailureException ( which
> > > inherits from DaoException typically), throw it. BO catches, rolls
> > > it into an DataStoreFatalApplicationException (which inherits from
> > > FatalApplicationExcpetion, which inherits from BOException), and
> > > throws it up to the UI, which handles figuring what to
> > display to the
> > user.
> > >
> >
> > So you don't include messages in the lower level exceptions?
> > Do you base
> > the message on the root exception? How 'bout stacktraces?
> > Do you log when
> > the error occurs or in the Action when you finally catch the
> > exception?
>
> I use the same pattern from SIA, so yes all that's included with the
cause.
>
> So, from the dao:
> catch( SQLException e){
> log.exception(e);
> throw new DaoFailureException( someVO.getPK(), e);
> }
>
I'm with you - mostly. I'm trying to do the same thing - I think...
}catch( NamingException e ){
MessageUtility mu = MessageUtility.getInstance(user.getLocale());
throw new LDAPException(mu.formatMessage(Constants.EXCEPTION_LDAP),
e);
}
If I follow you tho', where I'm forming a localized message, your
someVO.getPK() is not a message but the value of whatever it was that
caused the exception? Then at a higher level you just form a message based
on the higher exception.
> Then in the exception handler provided with struts, I'll usually try
> and make some determination as to what to include. If the user is
> an admin, or other technical user (ie i'm debugging different roles,
> or a user account etc and still want to see everything because I'm
> to bloody lazy to look at a log :) ) I'll include the entire stack trace.
>
> >
> > Forgive me if I'm asking too many ?s. I'm in a "sipping from
> > a firehose"
> > mode lately.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]