[BUG] Two :execute+:try/:catch bugs

Showing 1-2 of 2 messages
[BUG] Two :execute+:try/:catch bugs ZyX 9/15/13 3:43 AM
Consider the following script:

    function! ERB()
        execute "try"
           \."\n   echo tr()"
           \."\n catch"
           \."\n   echomsg v:exception"
           \."\n   return 1"
           \."\n endtry"
           \."\n return 0"
        return r
    endfunction
    echomsg ERB()
    execute "try"
       \."\n   call tr()"
       \."\n catch"
       \."\n   echomsg v:exception"
       \."\n endtry"

(also attached). If you source it with `vim -u NONE -N -S execute-return-bug.vim` you will see

    Vim(echo):E119: Not enough arguments for function: tr
    0
    Error detected while processing /home/zyx/tmp/vim/execute-return-bug.vim:
    line   16:
    E119: Not enough arguments for function: tr

while expected to see

    Vim(echo):E119: Not enough arguments for function: tr
    1
    Vim(call):E119: Not enough arguments for function: tr

(note the second line: it contains 1; and the third: it shows caught exception). If I unwrap the script (replace `:execute` calls with the string it executes) then everything works as expected.

Re: [BUG] Two :execute+:try/:catch bugs Bram Moolenaar 9/15/13 5:32 AM
I'll add it in the todo list.

--
hundred-and-one symptoms of being an internet addict:
214. Your MCI "Circle of Friends" are all Hayes-compatible.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///