Look at tapestry's ExceptionDisplay component source. It uses something
called an ExceptionAnalyzer and also displays the contents of the
ExceptionDescription.getProperties().
I've got a custom exception page that writes to log4j. Here's what I
use to get the text:
public void logException(Throwable value) {
ExceptionAnalyzer analyzer = new ExceptionAnalyzer();
ExceptionDescription[] exceptions = analyzer.analyze(value);
setExceptions(exceptions);
StringBuffer text = new StringBuffer();
for (ExceptionDescription exception : exceptions) {
text.append("Class: " + exception.getExceptionClassName() +
"\n");
text.append("Message: " + exception.getMessage() + "\n");
for (ExceptionProperty property : exception.getProperties()) {
text.append("Property: " + property.getName() + " = " +
property.getValue() + "\n");
}
}
String[] stack = exceptions[exceptions.length-1].getStackTrace();
for (String stackItem : stack) {
text.append(stackItem + "\n");
}
log.error(text.toString());
}
-Steve
[EMAIL PROTECTED] wrote:
Can anyone help me out with a snippet of code? On my Exception.html/.page I
have a simple @Insert with getError(). Here's my code, but it doesn't provide a
nice traceback :(
public String getError()
{
ExceptionDescription[] Errors = getExceptions();
String err = "";
for (int i = 0; i < Errors.length; i++)
err += Errors[i].getMessage() + "<br>";
return err;
}
Any ideas?
Thanks,
Greg
---------------------------------------------------------------------
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]