You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by "Matt Raible <matt_raible@yahoo.com>" <ma...@yahoo.com> on 2002/12/27 23:00:24 UTC
Fwd: Declared Exceptions and Chained Exceptions
I didn't get a response from the User List - so maybe one of you
gents will know the answer.
Thanks,
Matt
--- In struts@yahoogroups.com, "Matt Raible" <ma...@r...> wrote:
Can I use Declarative Exceptions and Chained Exceptions at the same
time? I'd love to be a able to specify a list of exceptions in my
struts-config.xml, and have those errors stacked on each other.
Currently, I'm rendering ChainedExceptions using the following, and
would love to do it in struts-config.xml instead. Any advice or
suggestions are appreciated.
try {
UserManager mgr =
new UserManagerImpl(
(String) ctx.getAttribute(Constants.DAO_TYPE));
UserForm user = mgr.getUser(username);
session.setAttribute(Constants.USER_KEY, user);
} catch (Exception e) {
log.error("Error getting user's information " + e);
e.printStackTrace();
ActionErrors errors = new ActionErrors();
errors.add(
ActionErrors.GLOBAL_ERROR,
new ActionError("errors.general"));
StringBuffer sb = new StringBuffer();
if (e.getCause() == null) {
sb.append(e.getMessage());
} else {
while (e.getCause() != null) {
sb.append(e.getMessage());
e = (Exception) e.getCause();
}
}
errors.add(
ActionErrors.GLOBAL_ERROR,
new ActionError("errors.detail", sb.toString()));
}
Thanks,
Matt
--
To unsubscribe, e-mail: <ma...@j...>
For additional commands, e-mail: <ma...@j...>
--- End forwarded message ---
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>