summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2026-04-19 17:37:03 +0200
committerJustin M. Keyes <justinkz@gmail.com>2026-04-20 02:31:09 +0200
commita38451be40ca571e9c55656b19ea8926d5f4524b (patch)
tree356541812ac11bebb8547bcc4018b46679571749 /src
parent919a1099510a6998bd7edeaaa0522719687242b7 (diff)
fix(excmd): nlua_call_excmd require() failure is a "lua_error"
Although `nlua_call_excmd` is semantically for implementing Ex-commands, the `require()` should never fail, so that's a "Lua error". But if the call itself fails (the later `semsg` call), that's an "Ex cmd" error.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_eval.c4
-rw-r--r--src/nvim/lua/executor.c6
2 files changed, 6 insertions, 4 deletions
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index cedb58b4d0..ebbb940422 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -378,7 +378,9 @@ bool do_intthrow(cstack_T *cstack)
return true;
}
-/// Get an exception message that is to be stored in current_exception->value.
+/// Gets an exception message that is to be stored in current_exception->value.
+///
+/// For error exceptions (ET_ERROR), formats the message as "Vim(cmdname):Exx: …".
char *get_exception_string(void *value, except_type_T type, char *cmdname, bool *should_free)
{
char *ret;
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index d770cdbb5e..1771a01565 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -1785,8 +1785,7 @@ bool nlua_call_excmd(const char *module, const char *func, exarg_T *eap, const c
lua_getglobal(lstate, "require");
lua_pushstring(lstate, module);
if (lua_pcall(lstate, 1, 1, 0) != 0) {
- semsg("E5108: %s", lua_tostring(lstate, -1));
- lua_pop(lstate, 1);
+ nlua_error(lstate, "E5108: %s");
return false;
}
lua_getfield(lstate, -1, func);
@@ -1802,7 +1801,8 @@ bool nlua_call_excmd(const char *module, const char *func, exarg_T *eap, const c
}
if (nlua_pcall(lstate, nargs, 0)) {
- semsg("E5108: %s", lua_tostring(lstate, -1));
+ // Not "E5108" because this is a logical/application error, not a "Lua error".
+ emsg(lua_tostring(lstate, -1));
lua_pop(lstate, 1);
return false;
}