aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/lua/executor.c2
-rw-r--r--test/functional/lua/luaeval_spec.lua12
2 files changed, 13 insertions, 1 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index 9f30609d66..ea53a8ebc2 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -987,7 +987,7 @@ int typval_exec_lua_callable(
PUSH_ALL_TYPVALS(lstate, argvars, argcount, false);
if (lua_pcall(lstate, argcount + offset, 1, 0)) {
- luaL_error(lstate, "nlua_CFunction_func_call failed.");
+ nlua_print(lstate);
return ERROR_OTHER;
}
diff --git a/test/functional/lua/luaeval_spec.lua b/test/functional/lua/luaeval_spec.lua
index 964ea4561e..75966393b1 100644
--- a/test/functional/lua/luaeval_spec.lua
+++ b/test/functional/lua/luaeval_spec.lua
@@ -255,6 +255,18 @@ describe('luaeval()', function()
]])
end)
+ it('can handle functions with errors', function()
+ eq(true, exec_lua [[
+ vim.fn.timer_start(10, function()
+ error("dead function")
+ end)
+
+ vim.wait(1000, function() return false end)
+
+ return true
+ ]])
+ end)
+
it('should handle passing functions around', function()
command [[
function VimCanCallLuaCallbacks(Concat, Cb)