You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/01/05 07:45:07 UTC
DO NOT REPLY [Bug 15805] New: -
Enhance ModuleException to allow getting chained Exceptions
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15805>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15805
Enhance ModuleException to allow getting chained Exceptions
Summary: Enhance ModuleException to allow getting chained
Exceptions
Product: Struts
Version: Nightly Build
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Utilities
AssignedTo: struts-dev@jakarta.apache.org
ReportedBy: matt@raibledesigns.com
It'd be nice if it was possible to use a ModuleException to get a list of
chained exceptions and display them to the user.
I don't know how this would work, but using JDK 1.4, it might look something
like that below. This doesn't compile, but hopefully you get the idea - or
maybe I can already do it with this?
public class GeneralException extends ModuleException {
//~ Constructors ===========================================================
/**
* Construct a new instance of this exception
*/
public GeneralException() {
super("errors.general");
}
/**
* Constructor for this exception that allows you to pass in an exception
* with possible causes.
*
* @param e
*/
public GeneralException(Exception e) {
super("errors.detail", getChainedExceptions(e));
}
protected String getChainedExceptions(Exception e) {
StringBuffer sb = new StringBuffer();
if (e.getCause() == null) {
sb.append(e.getMessage());
} else {
while (e.getCause() != null) {
sb.append(e.getMessage());
sb.append("\n");
e = (Exception) e.getCause();
}
}
return sb.toString();
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>