I started looking at the stacktrace and reading the code.  It seems that
ErrorReportValve class is responsible for trapping throwable and creating
the report that is sent to the browser.  So I made a copy and renamed it to
WMErrorReportValve and attached a Valve element at the Host level.  This
seemed to work since now when I throw an exception I see WMErrorReportVavle
in the stacktrace and not ErrorReportValve.

Can anyone confirm that this is the correct way to handle exceptions, since
this valve isn't documented anywhere.

Thanks,
Subir

-----Original Message-----
From: Subir Sengupta [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 12, 2002 3:49 PM
To: '[EMAIL PROTECTED]'
Subject: Exception Handling


Hi,

I'd like to be able to trap all exceptions and show users a friendly error
page.  I know I can specify which exception to trap in the web.xml file and
what error pages to display. But it seems that will only trap exceptions
that I specify and let any other exceptions through!  So that doesn't seem
like a very practical way to deal with exceptions.

When an exception is thrown, Tomcat prints the stacktrace to the browser.
Is there a way to hook into this mechanism and have Tomcat display an error
page instead.  Also I'd like to have an email with the exception sent to me.

There may already be a way to do this that I don't know about.  Any pointers
are appreciated.

I'm using Tomcat 4.0.3 on linux.

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to