You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Wendy Smoak <We...@asu.edu> on 2003/04/25 01:28:36 UTC

Dealing with exceptions

In the process of hiding the stack trace from my users, I've hidden it from
myself!  I catch the exception and forward to my "failure" page which
displays a pretty message.

I'm trying to track down a problem in my database access layer.  If I catch
an exception and do ex.printStackTrace() in my Action, then the Tomcat logs
show some information, but right when it gets interesting I see "51
more...".   It truncates the stack trace.

So now I'm placing the exception in request scope, and trying to print it
out with JSTL.  Doing this <c:out value="${exception}" /> just prints the
message.

To get the stack trace, I'm doing this:

<c:forEach items="${exception.stackTrace}" var="element">
    <c:out value="${element}" /><br>
</c:forEach> 

Which works, but I don't think I'm getting everything.  Sometimes there's a
"cause" that I need to get from the initial exception, and I need the stack
trace from the cause.  And there could be a chain of these, although in
practice I think mine are only two deep.

I'm following Ted's "Use chained exceptions" advice:
http://husted.com/struts/tips/015.html

But I must be missing something, because I can't easily get the information
I'm looking for.

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University PA Information Resources Management