Push formatter on lua stack only if does not throw exceptions

This commit is contained in:
Luca Marturana 2016-12-02 16:13:37 +01:00 committed by Mark Stemm
parent 3840622984
commit ea97325708

View File

@ -49,14 +49,13 @@ int falco_formats::formatter(lua_State *ls)
try
{
formatter = new sinsp_evt_formatter(s_inspector, format);
lua_pushlightuserdata(ls, formatter);
}
catch(sinsp_exception& e)
{
luaL_error(ls, "Invalid output format '%s': '%s'", format.c_str(), e.what());
}
lua_pushlightuserdata(ls, formatter);
return 1;
}