I usually wack log and assert false; if there is nothing better to do with it at the time. In situtations where you know an exception can never be thrown, I still would leave in at least this.
Of course this view also comes I'm sure from being in your position before now. I don't recall but it's bound to have happened sometime the years I've been doing this.



Jim Barrows wrote:



-----Original Message-----
From: Dan Allen [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 02, 2004 10:46 AM
To: Struts Users Mailing List
Subject: never, ever bury an exception!


I know that this might be obvious, but I am telling you all just so that you can learn from my pain. Because of time pressure, I accidently left an caught exception in the following state:

catch (Exception e)
{
 // TODO: do something with me
}




oooo yuckky!!! I share you're pain. Very deeply. More importantly.. I share the egg on your face... because I know you knew that you should have at least an e.printStackTrace() there. And didn't do it.
Which is why now, eclipse autogenerates all my try catch blocks, because it doesn't forget to do e.printStacktrace(), or get lazy and not do it, or forget to do it.





For the last couple of days the application server has been coming
crashing down.  The problem was that this particular exception was
being thrown as the result of a StackOverflow error.  When the
exception was silenced, the execution would go back around and throw
the StackOverflow error again inside a loop.  Eventually, memory would
become expended and the app server would die.  But because the error
is totally silenced, no reason is given for the crash because the app
server didn't receive any messages.

At the very, very least, log the error.  That will give you an inkling
of an idea as to where the server might be dying.  Even if there is no
way you think that the code you wrote would lead to a StackOverflow
(or some other accumulating problem), do it anyway.  Point is, you are
better safe then sorry.  I am an idiot for leaving that exception in
that state, but at least I learned my lesson.

Dan

--
Open Source Advocacy
http://www.mojavelinux.com

---------------------------------------------------------------------
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]





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



Reply via email to