Hello,

On Mon, May 16, 2011 at 23:51, Spiros Bousbouras <spi...@gmail.com> wrote:
> function! Foo()
>    throw 0
> endfunction
>
> if 1
>    call Foo()
> endif
>
>
> When I execute the above script I get
>    E605: Exception not caught: 0
> [...]
>    line    6:
>    E171: Missing :endif

Like in most programing languages (actually all of which I know), you
need to 'try' (:he :try) and 'catch' (:he :catch) exceptions.

Your function call could then be:

if 1
        try
                call Foo()
        catch /.*/
                echo "Caught thrown exception (whatever it is)"
        endtry
endif

Then the endif can be reached even if an exception is thrown.

Regards,

Tinou

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to