Patch 8.2.3448
Problem:    :endtry after function call that throws not found.
Solution:   Do check for following :endtry if an exception is being thrown.
            (closes #8889)
Files:      src/userfunc.c, src/testdir/test_trycatch.vim


*** ../vim-8.2.3447/src/userfunc.c      2021-09-08 15:33:25.160576403 +0200
--- src/userfunc.c      2021-09-18 13:53:22.659863603 +0200
***************
*** 5011,5024 ****
        --emsg_skip;
      clear_evalarg(&evalarg, eap);
  
!     // When inside :try we need to check for following "| catch".
!     if (!aborting() && (!failed || eap->cstack->cs_trylevel > 0))
      {
        // Check for trailing illegal characters and a following command.
        arg = skipwhite(arg);
        if (!ends_excmd2(eap->arg, arg))
        {
!           if (!failed)
            {
                emsg_severe = TRUE;
                semsg(_(e_trailing_arg), arg);
--- 5011,5026 ----
        --emsg_skip;
      clear_evalarg(&evalarg, eap);
  
!     // When inside :try we need to check for following "| catch" or "| 
endtry".
!     // Not when there was an error, but do check if an exception was thrown.
!     if ((!aborting() || did_throw)
!                                 && (!failed || eap->cstack->cs_trylevel > 0))
      {
        // Check for trailing illegal characters and a following command.
        arg = skipwhite(arg);
        if (!ends_excmd2(eap->arg, arg))
        {
!           if (!failed && !aborting())
            {
                emsg_severe = TRUE;
                semsg(_(e_trailing_arg), arg);
*** ../vim-8.2.3447/src/testdir/test_trycatch.vim       2021-09-08 
15:33:25.160576403 +0200
--- src/testdir/test_trycatch.vim       2021-09-18 13:52:15.767808933 +0200
***************
*** 2236,2242 ****
        catch /my_error/
          let caught = 'yes'
        catch
!         let caught = 'no'
        endtry
        call assert_equal('yes', caught)
    END
--- 2236,2242 ----
        catch /my_error/
          let caught = 'yes'
        catch
!         let caught = v:exception
        endtry
        call assert_equal('yes', caught)
    END
***************
*** 2247,2252 ****
--- 2247,2278 ----
    unlet g:caught
  endfunc
  
+ " Test for using throw in a called function with following endtry    {{{1
+ func Test_user_command_function_call_with_endtry()
+   let lines =<< trim END
+       funct s:throw(msg) abort
+         throw a:msg
+       endfunc
+       func s:main() abort
+         try
+           try
+             throw 'err1'
+           catch
+             call s:throw('err2') | endtry
+           catch
+             let s:caught = 'yes'
+         endtry
+       endfunc
+ 
+       call s:main()
+       call assert_equal('yes', s:caught)
+   END
+   call writefile(lines, 'XtestThrow')
+   source XtestThrow
+ 
+   call delete('XtestThrow')
+ endfunc
+ 
  
  " Modeline                                                                {{{1
  " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
*** ../vim-8.2.3447/src/version.c       2021-09-18 12:15:03.691013353 +0200
--- src/version.c       2021-09-18 13:54:54.439917921 +0200
***************
*** 759,760 ****
--- 759,762 ----
  {   /* Add new patch number below this line */
+ /**/
+     3448,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
34. You laugh at people with a 10 Mbit connection.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202109181326.18IDQgAm2449937%40masaka.moolenaar.net.

Raspunde prin e-mail lui