mirror of
https://github.com/falcosecurity/falco.git
synced 2025-06-28 15:47:25 +00:00
Minor error handling improvements
This commit is contained in:
parent
019e76114e
commit
aea9b0054b
@ -114,7 +114,7 @@ void do_inspect(sinsp* inspector,
|
|||||||
if(lua_pcall(ls, 2, 0, 0) != 0)
|
if(lua_pcall(ls, 2, 0, 0) != 0)
|
||||||
{
|
{
|
||||||
const char* lerr = lua_tostring(ls, -1);
|
const char* lerr = lua_tostring(ls, -1);
|
||||||
string err = "Error installing rules: " + string(lerr);
|
string err = "Error invoking function output: " + string(lerr);
|
||||||
throw sinsp_exception(err);
|
throw sinsp_exception(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ int digwatch_fields::field(lua_State *ls)
|
|||||||
|
|
||||||
if(chk == NULL)
|
if(chk == NULL)
|
||||||
{
|
{
|
||||||
string err = "nonexistent fieldname passed to digwatch.field()" + string(fieldname);
|
string err = "nonexistent fieldname passed to digwatch.field(): " + string(fieldname);
|
||||||
fprintf(stderr, "%s\n", err.c_str());
|
fprintf(stderr, "%s\n", err.c_str());
|
||||||
throw sinsp_exception("digwatch.field() error");
|
throw sinsp_exception("digwatch.field() error");
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,11 @@ function mod.first_sequence(evt, fieldname, key, format)
|
|||||||
msg = digwatch.format_event(evt, formatter)
|
msg = digwatch.format_event(evt, formatter)
|
||||||
print (msg)
|
print (msg)
|
||||||
end
|
end
|
||||||
|
if field_value == nil then
|
||||||
|
formatter = digwatch.formatter(format)
|
||||||
|
s = digwatch.format_event(evt, formatter)
|
||||||
|
error("first_sequence: field '"..fieldname.."' is nil in event ("..s..")")
|
||||||
|
end
|
||||||
first_sequence_state[key][field_value] = now
|
first_sequence_state[key][field_value] = now
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -164,6 +164,10 @@ end
|
|||||||
|
|
||||||
evt = nil
|
evt = nil
|
||||||
function on_event(evt_, rule_id)
|
function on_event(evt_, rule_id)
|
||||||
|
if state.outputs[rule_id] == nil then
|
||||||
|
error ("rule_loader.on_event(): event with invalid rule_id: ", rule_id)
|
||||||
|
end
|
||||||
|
|
||||||
if state.outputs[rule_id].type == "format" then
|
if state.outputs[rule_id].type == "format" then
|
||||||
print(digwatch.format_event(evt_, state.outputs[rule_id].formatter))
|
print(digwatch.format_event(evt_, state.outputs[rule_id].formatter))
|
||||||
elseif state.outputs[rule_id].type == "function" then
|
elseif state.outputs[rule_id].type == "function" then
|
||||||
|
Loading…
Reference in New Issue
Block a user