logo       

RE: Re: distinguishing between failures and errors: msg#00150

java.junit.user

Subject: RE: Re: distinguishing between failures and errors

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




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise