Adam Gifford wrote:

> Hello,
>       in my servlet i've been getting out of memory errors and instead
> of having the users see a "error 500 internal server error" message, i
> thought it would be nice to just print the exception out to the screen
> instead of having to look through the logs.
> This part i found was easy to do, however i also would like it to wind
> up in the logs as before.
>
> doPost() throws ServletException, IOException {
> try {
> my code();
> }
> catch(RuntimeException ex) {
> send to output stream(ex);
> close output stream();
> throw ex;
> }
> catch(Error er) {
> send to output stream(er);
> close output stream();
> throw er;
> }
> }
>
> however this doesn't catch ClassNotFoundExceptions, and some others.
> Does anyone have any other ideas? a suggestion i got from someone else
> was to catch throwable (or exception) and wrap it in a runtimeexception.
>

solution is to write a wrapper class extending RuntimeException and rethrow
that





----------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
READ THE FAQ!!!!     <http://java.apache.org/faq/>
Archives and Other:  <http://java.apache.org/main/mail.html/>
Problems?:           [EMAIL PROTECTED]

Reply via email to