Re: Try Finally...

From: VBDis (vbdis_at_aol.com)
Date: 10/28/04


Date: 28 Oct 2004 07:59:18 GMT

Im Artikel <kegsn0lt1oklojovi15r4ueg3ekatl9v2c@4ax.com>, L D Blake
<not@any.adr> schreibt:

>>You mean one should have two options ?
>>1) Let it roll on (after possibly correcting something)
>>2) Terminate the application
>
>Yep... and that's exactly what I was asking about at the beginning on this
>entire mess...
>
>What should "Finally" do with continuable exceptions?

Ooops, glad to catch this message prior to sending it.

Only after another enlightening contribution I understood why Finally must be
implemented as an exception handler, not as an termination handler. This was a
big misunderstanding till now :-(

But what should Finally do at all, with regards to SEH? IMO it should behave as
is, i.e. return 1 to signal unhandled. Otherwise something like a global
variable would be required, that could be set inside the user code of Finally.
The modified Finally handler then can return this value, AND must reset the
variable to the default state, to prevent wrong signalling when another Finally
block leaves that variable in an unchanged state. The detailed decision about
the value to return is another topic, depending on the access from user code to
the details of the exception.

So the first question IMO is, WHY should Finally have a chance to resume the
application. Only then we need to research how this could be made work. Please
excuse my weak memory, and tell me again why you want Finally to eventually
stop an exception? Wouldn't it be equivalent to:

try ...
except Whatsoever; raise; //non-stopping, as Finally is now
end;

or

try ...
except Repair; //exception cought, resume normal operation
end;

In case somebody missed this:

try Whatever;
except //no code here
end;

simply catches all exceptions and resumes normal operation. Of course
finalization or other repair could be done in the Except code. This is why I
don't understand a need for another way to accomplish such already available
behaviour.

DoDi



Relevant Pages

  • Re: Exception management question...
    ... The following demonstrates swallowing an exception... ... > to propagate up to a global exception handler which logs the exception and ... > closes down the app? ... should terminate the app, then wave bye-bye because you cannot change that ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Exception management question...
    ... There is code in my app that follows this general pattern: ... This allows an exception to be thrown with the next line of code attempts to ... >> to propagate up to a global exception handler which logs the exception ... > has determined that the app should terminate the UE handler has no means ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Throwing exception from _invalid_parameter_handler
    ... >mentions two actions the handler cat take: terminate the application or exit ... It doesn't explicitly mention throwing a C++ exception from the ... called from functions declared extern "C", ...
    (microsoft.public.vc.language)
  • Continue running after unhandled exception caught
    ... I've set the unhandled exception to be handled by my handler, ... know how to clear the exception record and make the program continute to run. ... infinely loop. ... If I don't want to terminate the application and resume execution, ...
    (microsoft.public.vc.language)
  • Re: Try Finally...
    ... handler in this record. ... The separation into Filter, Exception, and Termination ... Now the Finally handler is called again and the user code executes. ...
    (comp.lang.pascal.delphi.misc)