From 88c89c77229e725ab2613b022249e2f506d82b82 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 14 Aug 2021 14:01:05 +0200 Subject: patch 8.2.3341: Vim9: function call aborted despite try/catch Problem: Vim9: function call aborted despite try/catch. (Naohiro Ono) Solution: Ignore error caught by try/catch. (closes #8755) --- src/vim9execute.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/vim9execute.c') 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 } -- cgit v1.2.1