finally block may be nested inside a
try AcquireResources; try UseResource; finally ReleaseResource; end; except on E: EResourceUsageError do begin HandleResourceErrors; end; end;
If an exception occurs inside
UseResource, then execution will jump to
ReleaseResource. If the exception is an
EResourceUsageError, then execution will jump to the exception handler and call
HandleResourceErrors. Exceptions of any other type will skip the exception handler above and bubble up to the next
except block up the call stack.
ReleaseResource will cause execution to go to the exception handler, skipping the
finally block, either because the corresponding
try block has not been entered yet or because the
finally block has already been entered.