Patch 8.2.3416
Problem: Second error is reported while exception is being thrown.
Solution: Do not check for trailing characters when already aborting.
(closes #8842)
Files: src/userfunc.c, src/testdir/test_trycatch.vim
*** ../vim-8.2.3415/src/userfunc.c 2021-09-06 20:56:53.296274317 +0200
--- src/userfunc.c 2021-09-08 15:32:58.800608511 +0200
***************
*** 5012,5018 ****
clear_evalarg(&evalarg, eap);
// When inside :try we need to check for following "| catch".
! if (!failed || eap->cstack->cs_trylevel > 0)
{
// Check for trailing illegal characters and a following command.
arg = skipwhite(arg);
--- 5012,5018 ----
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);
*** ../vim-8.2.3415/src/testdir/test_trycatch.vim 2020-12-13 20:26:25.928035621 +0100
--- src/testdir/test_trycatch.vim 2021-09-08 15:32:19.136654695 +0200
***************
*** 2224,2228 ****
--- 2224,2252 ----
unlet g:caught
endfunc
+ " Test for using throw in a called function with following error {{{1
+ func Test_user_command_throw_in_function_call()
+ let lines =<< trim END
+ function s:get_dict() abort
+ throw 'my_error'
+ endfunction
+
+ try
+ call s:get_dict().foo()
+ catch /my_error/
+ let caught = 'yes'
+ catch
+ let caught = 'no'
+ endtry
+ call assert_equal('yes', caught)
+ END
+ call writefile(lines, 'XtestThrow')
+ source XtestThrow
+
+ call delete('XtestThrow')
+ unlet g:caught
+ endfunc
+
+
" Modeline {{{1
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
*** ../vim-8.2.3415/src/version.c 2021-09-08 14:57:38.237188053 +0200
--- src/version.c 2021-09-08 15:26:46.417176056 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3416,
/**/
--
hundred-and-one symptoms of being an internet addict:
8. You spend half of the plane trip with your laptop on your lap...and your
child in the overhead compartment.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///