mirror of
https://github.com/neovim/neovim.git
synced 2026-05-27 15:25:33 +00:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user