Re: Exception handlers [was: Traps for module writers]

Gerd Knops (gerti@bitart.com)
Wed, 27 Nov 96 16:50:16 -0600


Chaimf@cris.com wrote:
> Peter Seibel wrote:
> > The finally clause runs *before* the catch (or except) clauses. I forget
> > now why; I think because that's how either Lisp or Java or both did
> > it. Or maybe because otherwise there's no good way to guarantee it gets
> > run. Anyway, I can post the code of the Exceptions module if folks are
> > interested.
>
> Could you check that. It might be different for different languages.
> But my impression was that they usually run after the catch clauses.
>
Java does the following in case of an exception in the try block:

If there is a local catch block that handles the thrown exception type,  
control gets transfered to that catch block first, then to the finally  
block. If no local catch block handles the exception, finally is exected,  
and then it propagets to the nearest higher catch block that can handle the  
thrown exception.

Gerd
gerti@BITart.com