|
Re: Re: distinguishing between failures and errors: msg#00166java.junit.user
neil_swingler wrote: >You want to recover from an exception? :-) > Yes, sometimes I do. > >In the projects I have worked on, 99% of exceptions are not >recoverable. More to the point it is not economically viable >to write and maintain the recovery code. > I agree that you have to be practical about the cost of recovery. Sometimes handling an exception in context is more economical than exiting gracefully. When's the last time your application server crashed because your servlet raised an exception? > >If an exception is caused by a >software error I just want the stacktrace to be logged. Forcing >developers to write catch clauses for checked exceptions increases >the possiblity they will lose that original stacktrace. > In my experience, users don't understand stack traces. I generally log stack traces to a file, but print something the user understands to the console. That requires the use of a catch clause. > >Have you not been in the position of debugging a stacktrace to find >that it was just a rethrow of another exception which has now been >lost? > I'll take that as a non-rhetorical question. I have been in that unfortunate situation. It's certainly no fun. However, that pain isn't born solely out of handling exceptions in a catch clause. > >My preference would be to use unchecked exceptions everywhere and >maybe use checked exceptions (refactor from unchecked to checked) >where I will explicitely try to do some recovery. > Fair enough. Do what works for you. Mike
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: 3.8 candidate, Mike Clark |
|---|---|
| Next by Date: | RE: Re: distinguishing between failures and errors, Daniel Barclay |
| Previous by Thread: | Re: distinguishing between failures and errors, neil_swingler |
| Next by Thread: | OT: Bad examples everywhere (Was: distinguishing between failures and errors), Mathieu Gervais |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |