# Exception handlers

Pavel Curtis (pavel@parc.xerox.com)
Wed, 21 Feb 1996 10:18:11 PST

- Messages sorted by:[ date ][ thread ][ subject ][ author ]

    Tom Meyer writes:
    > I've been playing a bit with the exception handlers in 1.8.0beta3, and
    > don't understand why I can't do the following:
    >   try
    >     <some code here>
    >   except
    >     <some exception>
    >   finally
    >     <Code to clean up in any case>
    >   endtry
    >
    > I can use either the EXCEPT or the FINALLY part in the try statement,
    > but can't use both.

    You can't do this because I didn't implement it that way and it would be
    difficult to fix it now.  Write something like that as follows:

    	try
    	  try
    	    <some code here>
    	  except (...)
    	    <some handler>
    	  endtry
    	finally
    	  <Code to clean up in any case>
    	endtry

    I actually find this more readable, since it's more clear which of the EXCEPT
    and FINALLY parts is wrapped more tightly around the main TRY body.

    	Pavel