mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
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)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user