summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-09-08 15:33:30 +0200
committerBram Moolenaar <Bram@vim.org>2021-09-08 15:33:30 +0200
commit36f691f5f1d0676f080cc97d697d742ed5cc8251 (patch)
treef409093af58654e889d8dba96aa743ac6e28e884
parentfc3b775055c2361e507a1a44008d5a7d37eecf14 (diff)
patch 8.2.3416: second error is reported while exception is being thrownv8.2.3416
Problem: Second error is reported while exception is being thrown. Solution: Do not check for trailing characters when already aborting. (closes #8842)
-rw-r--r--src/testdir/test_trycatch.vim24
-rw-r--r--src/userfunc.c2
-rw-r--r--src/version.c2
3 files changed, 27 insertions, 1 deletions
diff --git a/src/testdir/test_trycatch.vim b/src/testdir/test_trycatch.vim
index b5ad14c2a5..702d6dabb6 100644
--- a/src/testdir/test_trycatch.vim
+++ b/src/testdir/test_trycatch.vim
@@ -2224,5 +2224,29 @@ func Test_user_command_try_catch()
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
diff --git a/src/userfunc.c b/src/userfunc.c
index e51df51ffd..dc0a939eb6 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -5012,7 +5012,7 @@ ex_call(exarg_T *eap)
clear_evalarg(&evalarg, eap);
// When inside :try we need to check for following "| catch".
- if (!failed || eap->cstack->cs_trylevel > 0)
+ if (!aborting() && (!failed || eap->cstack->cs_trylevel > 0))
{
// Check for trailing illegal characters and a following command.
arg = skipwhite(arg);
diff --git a/src/version.c b/src/version.c
index a349398bfe..c28a302a31 100644
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3416,
+/**/
3415,
/**/
3414,