degesch: Lua: provide a traceback on load error
This commit is contained in:
parent
83c14ba264
commit
53e72dd12d
13
degesch.c
13
degesch.c
@ -8632,12 +8632,17 @@ lua_plugin_load (struct app_context *ctx, const char *filename,
|
|||||||
lua_plugin_create_meta (L, XLUA_CONNECTION_METATABLE, lua_connection_table);
|
lua_plugin_create_meta (L, XLUA_CONNECTION_METATABLE, lua_connection_table);
|
||||||
lua_plugin_create_meta (L, XLUA_CONNECTOR_METATABLE, lua_connector_table);
|
lua_plugin_create_meta (L, XLUA_CONNECTOR_METATABLE, lua_connector_table);
|
||||||
|
|
||||||
int ret;
|
struct error *error = NULL;
|
||||||
if (!(ret = luaL_loadfile (L, filename))
|
if (luaL_loadfile (L, filename))
|
||||||
&& !(ret = lua_pcall (L, 0, 0, 0)))
|
error_set (e, "%s: %s", "Lua", lua_tostring (L, -1));
|
||||||
|
else if (!lua_plugin_call (plugin, 0, 0, &error))
|
||||||
|
{
|
||||||
|
error_set (e, "%s: %s", "Lua", error->message);
|
||||||
|
error_free (error);
|
||||||
|
}
|
||||||
|
else
|
||||||
return &plugin->super;
|
return &plugin->super;
|
||||||
|
|
||||||
error_set (e, "%s: %s", "Lua", lua_tostring (L, -1));
|
|
||||||
lua_close (L);
|
lua_close (L);
|
||||||
free (plugin);
|
free (plugin);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user