Return lua errors not falco_exceptions

In C functions that implement lua functions, don't directly throw
falco_exceptions, which results in opaque error messages like:

Mon Feb 27 10:09:58 2017: Runtime error: Error invoking function output:
C++ exception. Exiting.

Instead, return lua errors via lua_error().
This commit is contained in:
Mark Stemm
2017-02-27 11:57:36 -08:00
parent 7d711dbb32
commit fb36af12cf
2 changed files with 8 additions and 4 deletions

View File

@@ -81,7 +81,8 @@ int falco_formats::format_event (lua_State *ls)
!lua_isstring(ls, -2) ||
!lua_isstring(ls, -3) ||
!lua_islightuserdata(ls, -4)) {
throw falco_exception("Invalid arguments passed to format_event()\n");
lua_pushstring(ls, "Invalid arguments passed to format_event()");
lua_error(ls);
}
sinsp_evt* evt = (sinsp_evt*)lua_topointer(ls, 1);
const char *rule = (char *) lua_tostring(ls, 2);