Re: throw in a finally

From: VisionSet (spam_at_ntlworld.com)
Date: 08/13/04


Date: Fri, 13 Aug 2004 16:22:27 GMT


"Tony Morris" <not@telling.you> wrote in message
news:Ux0Tc.54958$K53.41705@news-server.bigpond.net.au...
> Any explanation I give is going to be redundant with any and all of the
> other well-documented texts available that point out this problem.
> Suffice to say that your tool is correct (it is a high severity defect)
and
> that the reasons behind it are the same as the reasons behind why
explicitly
> returning from a throws clause is a bad thing to do.
>
> As a general rule, "Never throw or return from within a finally clause -
the
> consequences of this are ... <well-documented/>".

Are we saying:

Don't throw in a finally.
Catch exceptions thrown in a finally even if the method declares they are
thrown
Catch exceptions and just log them.
Take the view that the finally is a bonus, if there was an exception in the
try, then that is the important one, that is what the user may get to see.

I guess you just can't have two separate exeception stacks thrown.

--
Mike W


Relevant Pages

  • Re: Try .. Catch with no Exception needed.
    ... In catching all exceptions (instead of just ones you know are going to be thrown) you are corrupting your application state to some degree, and if you aren't fastidious about defining the boundaries of your application, you will have unexpected errors because of exceptions that were thrown and ignored in other areas. ... There are reasons that exceptions are thrown, and you should ignore them at your own peril. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: xmalloc string functions
    ... a bit over three quarters of the memory, Lotus Notes, another email ... I have good reasons for using multiple email clients ... propagating the error conditions back to the caller. ... event processing against oom exceptions either. ...
    (comp.lang.c)
  • Re: *This* is why we do it ourselves
    ... warned then thrown out the class. ... for the wrong reasons or with no aptitude for the particular subject. ... terminating 100 wires onto a terminal block. ...
    (uk.rec.motorcycles)
  • Re: Reflection problem
    ... I'm pretty sure that there are no exceptions being thrown while ... >> Incoming mail is certified Virus Free. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Configuration Error Not Helpful
    ... >What kind of error in the configuration section causes the exception to be ... schema validation, and any error that gets thrown from that gets this ... those exceptions never got displayed. ...
    (microsoft.public.dotnet.framework.aspnet)