Mercurial > vim
diff src/vim9execute.c @ 25609:f8bcd21e6e24 v8.2.3341
patch 8.2.3341: Vim9: function call aborted despite try/catch
Commit: https://github.com/vim/vim/commit/88c89c77229e725ab2613b022249e2f506d82b82
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 14 14:01:05 2021 +0200
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 https://github.com/vim/vim/issues/8755)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 14 Aug 2021 14:15:03 +0200 |
parents | 6f13d9ea0d04 |
children | 154663508d9b |
line wrap: on
line diff
--- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -844,12 +844,13 @@ may_restore_cmdmod(funclocal_T *funcloca } /* - * 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 }