|
RE: Re: distinguishing between failures and errors: msg#00151java.junit.user
How would you not know how to handle it? Now, I could see something like you *had* to handle it at a higher level, but I'd still pass it up via throwing it again (or a new one of the same type). -Eric --- Manuel Amago <mamago@xxxxxxxxxxx> wrote: > Which would suggest the combination of both > practices. > > Checked exceptions at the low level, so that you get > context > information, and handle the error close to the > source. If you don't > know how to handle the error, wrap it up in an > unchecked exception, and > let it ripple up! > > Manuel Amago. > mailto:mamago@xxxxxxxxxxx > > > > -----Original Message----- > > From: Mike Clark [mailto:mike@xxxxxxxxxxxxx] > > Sent: 20 June 2002 18:11 > > To: junit@xxxxxxxxxxxxxxx > > Subject: Re: [junit] Re: distinguishing between > failures and errors > > > > > > 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] > > > > > > ------------------------ Yahoo! Groups Sponsor > > ---------------------~--> > > Free $5 Love Reading > > Risk Free! > > > http://us.click.yahoo.com/3PCXaC/PfREAA/Ey.GAA/5cFolB/TM > > > -------------------------------------------------------------- > > -------~-> > > > > To unsubscribe from this group, send an email to: > > junit-unsubscribe@xxxxxxxxxxxxxxx > > > > > > Your use of Yahoo! Groups is subject to > > http://docs.yahoo.com/info/terms/ > > > > > > __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: Re: distinguishing between failures and errors, Manuel Amago |
|---|---|
| Next by Date: | Re: distinguishing between failures and errors, neil_swingler |
| Previous by Thread: | RE: Re: distinguishing between failures and errors, Manuel Amago |
| Next by Thread: | Re: distinguishing between failures and errors, neil_swingler |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |