|
Re: Re: distinguishing between failures and errors: msg#00149java.junit.user
neil_swingler wrote: >--- In junit@xxxx, Mike Clark <mike@xxxx> wrote: > >>neil_swingler wrote: >> >>>Apart from making refactoring harder, checked exceptions also >>>make exception handling code more error prone. These are things >>>I have seen frequently where developers write code to handle >>> >checked > >>>exceptions: >>> >>>o Do nothing >>>o Print/log message (but not the stacktrace) >>>o Wrap the exception but lose the cause exception and it's >>> >stacktrace > >>>o catch Exception (also catches all those RuntimeExceptions they >>> had forgotten about >>> >>How does using unchecked exceptions help those developers? >> > >If they don't have to write any exception handling code they can't >code errors into it. The exceptions can propogate to a single >point to be logged. > How do you effectively handle all exceptions when they bubble up to a single common point? It seems to me the best you can do is log them and attempt to perform some generic action like exiting. Without the original context of the exception, it may be difficult to take any intelligent corrective action. Handling an exception closer to its point of origin is generally easier and less detrimental to the system. That said, I'd agree that if all exceptions bubble to the top then the use of unchecked exceptions eases maintenance. Otherwise all methods would need to declare all exceptions potentially thrown by those methods they call, ad infinitum. Messy, indeed. Mike [Non-text portions of this message have been removed]
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: FAQ entry critique (Re: Re: distinguishing between failures and errors), Mike Clark |
|---|---|
| Next by Date: | RE: Re: distinguishing between failures and errors, Manuel Amago |
| Previous by Thread: | Re: distinguishing between failures and errors, neil_swingler |
| Next by Thread: | RE: Re: distinguishing between failures and errors, Manuel Amago |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |