mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 10:26:31 +00:00
genmsgpack: Include error source in error messages
This commit is contained in:
@@ -393,8 +393,7 @@ local function process_function(fn)
|
|||||||
Error err = {.set = false};
|
Error err = {.set = false};
|
||||||
if (lua_gettop(lstate) != %i) {
|
if (lua_gettop(lstate) != %i) {
|
||||||
api_set_error(&err, Validation, "Expected %i argument%s");
|
api_set_error(&err, Validation, "Expected %i argument%s");
|
||||||
lua_pushstring(lstate, err.msg);
|
return luaL_error(lstate, "%%s", err.msg);
|
||||||
return lua_error(lstate);
|
|
||||||
}
|
}
|
||||||
]], lua_c_function_name, #fn.parameters, #fn.parameters,
|
]], lua_c_function_name, #fn.parameters, #fn.parameters,
|
||||||
(#fn.parameters == 1) and '' or 's'))
|
(#fn.parameters == 1) and '' or 's'))
|
||||||
@@ -414,8 +413,7 @@ local function process_function(fn)
|
|||||||
|
|
||||||
if (err.set) {
|
if (err.set) {
|
||||||
%s
|
%s
|
||||||
lua_pushstring(lstate, err.msg);
|
return luaL_error(lstate, "%%s", err.msg);
|
||||||
return lua_error(lstate);
|
|
||||||
}
|
}
|
||||||
]], param[1], cparam, param_type, table.concat(free_code, '\n ')))
|
]], param[1], cparam, param_type, table.concat(free_code, '\n ')))
|
||||||
free_code[#free_code + 1] = ('api_free_%s(%s);'):format(lc_param_type, cparam)
|
free_code[#free_code + 1] = ('api_free_%s(%s);'):format(lc_param_type, cparam)
|
||||||
@@ -440,8 +438,7 @@ local function process_function(fn)
|
|||||||
const %s ret = %s(%s);
|
const %s ret = %s(%s);
|
||||||
%s
|
%s
|
||||||
if (err.set) {
|
if (err.set) {
|
||||||
lua_pushstring(lstate, err.msg);
|
return luaL_error(lstate, "%%s", err.msg);
|
||||||
return lua_error(lstate);
|
|
||||||
}
|
}
|
||||||
nlua_push_%s(lstate, ret);
|
nlua_push_%s(lstate, ret);
|
||||||
api_free_%s(ret);
|
api_free_%s(ret);
|
||||||
@@ -453,8 +450,7 @@ local function process_function(fn)
|
|||||||
%s(%s);
|
%s(%s);
|
||||||
%s
|
%s
|
||||||
if (err.set) {
|
if (err.set) {
|
||||||
lua_pushstring(lstate, err.msg);
|
return luaL_error(lstate, "%%s", err.msg);
|
||||||
return lua_error(lstate);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
]], fn.name, cparams, free_at_exit_code))
|
]], fn.name, cparams, free_at_exit_code))
|
||||||
@@ -465,7 +461,7 @@ local function process_function(fn)
|
|||||||
end
|
end
|
||||||
|
|
||||||
for _, fn in ipairs(functions) do
|
for _, fn in ipairs(functions) do
|
||||||
if not fn.noeval then
|
if not fn.noeval or fn.name:sub(1, 4) == '_vim' then
|
||||||
process_function(fn)
|
process_function(fn)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user