I noticed that the following code produces no error messages, though thrown 
exception was not caught by any :catch blocks:
    function TestFinallyReturn()
        try
            throw "Test"
        finally
            " Same with :break/:continue in loops and :finally outside of
            " functions
            return 1
        endtry
    endfunction
    call TestFinallyReturn()
I think this behavior should be documented.
# HG changeset patch
# User ZyX <[email protected]>
# Date 1287091544 -14400
# Node ID e69a0294eaf314cf7f9aede9c0447ecfd170236b
# Parent  a0b03b7e9168b7f7fd61b1563ffdd6d09ca54260
Addded note about breaking statements in the :finally block

diff -r a0b03b7e9168 -r e69a0294eaf3 runtime/doc/eval.txt
--- a/runtime/doc/eval.txt	Thu Oct 14 21:29:37 2010 +0200
+++ b/runtime/doc/eval.txt	Fri Oct 15 01:25:44 2010 +0400
@@ -7009,6 +7009,10 @@
 			through to the ":finally" or by a |:continue|,
 			|:break|, |:finish|, or |:return|, or by an error or
 			interrupt or exception (see |:throw|).
+			Note: If :finally block itself contains 
+			|:continue|, |:break|, |:finish|, or |:return| then 
+			exception will not be propagated even if it was not 
+			caught.
 
 							*:th* *:throw* *E608*
 :th[row] {expr1}	The {expr1} is evaluated and thrown as an exception.

Attachment: signature.asc
Description: This is a digitally signed message part.

Raspunde prin e-mail lui