summaryrefslogtreecommitdiff
path: root/src/vim9execute.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-08-14 14:01:05 +0200
committerBram Moolenaar <Bram@vim.org>2021-08-14 14:01:05 +0200
commit88c89c77229e725ab2613b022249e2f506d82b82 (patch)
tree13d6d797ce01be15745d0b61b46ad8bdb23c4a5f /src/vim9execute.c
parent78a9c2e670d29349404b346e0aa90264cab19e9b (diff)
downloadvim-git-88c89c77229e725ab2613b022249e2f506d82b82.tar.gz
patch 8.2.3341: Vim9: function call aborted despite try/catchv8.2.3341
Problem: Vim9: function call aborted despite try/catch. (Naohiro Ono) Solution: Ignore error caught by try/catch. (closes #8755)
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r--src/vim9execute.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 04d5e5f27..4562a08bf 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -844,12 +844,13 @@ may_restore_cmdmod(funclocal_T *funclocal)
}
/*
- * Return TRUE if an error was given or CTRL-C was pressed.
+ * Return TRUE if an error was given (not caught in try/catch) or CTRL-C was
+ * pressed.
*/
static int
-vim9_aborting(int prev_called_emsg)
+vim9_aborting(int prev_uncaught_emsg)
{
- return called_emsg > prev_called_emsg || got_int || did_throw;
+ return uncaught_emsg > prev_uncaught_emsg || got_int || did_throw;
}
/*
@@ -882,12 +883,13 @@ call_by_name(
if (ufunc == NULL)
{
- int called_emsg_before = called_emsg;
+ int prev_uncaught_emsg = uncaught_emsg;
if (script_autoload(name, TRUE))
// loaded a package, search for the function again
ufunc = find_func(name, FALSE, NULL);
- if (vim9_aborting(called_emsg_before))
+
+ if (vim9_aborting(prev_uncaught_emsg))
return FAIL; // bail out if loading the script caused an error
}