More rule error/warnings handling cleanups

This commit is contained in:
Mark Stemm
2020-10-02 16:56:22 -07:00
parent 68018d3a69
commit bc570c58df
2 changed files with 14 additions and 7 deletions

View File

@@ -491,8 +491,7 @@ void falco_rules::load_rules(const string &rules_content,
if(!successful)
{
std::string err = "Could not load rules content: " + os.str();
throw falco_exception(err);
throw falco_exception(os.str());
}
if (verbose && os.str() != "") {

View File

@@ -804,7 +804,7 @@ int falco_init(int argc, char **argv)
}
catch(falco_exception &e)
{
printf("%s%s\n", prefix.c_str(), e.what());
printf("%s%s", prefix.c_str(), e.what());
throw;
}
printf("%sOk\n", prefix.c_str());
@@ -861,7 +861,15 @@ int falco_init(int argc, char **argv)
falco_logger::log(LOG_INFO, "Loading rules from file " + filename + ":\n");
uint64_t required_engine_version;
engine->load_rules_file(filename, verbose, all_events, required_engine_version);
try {
engine->load_rules_file(filename, verbose, all_events, required_engine_version);
}
catch(falco_exception &e)
{
std::string prefix = "Could not load rules file " + filename + ": ";
throw falco_exception(prefix + e.what());
}
required_engine_versions[filename] = required_engine_version;
}
@@ -1171,8 +1179,8 @@ int falco_init(int argc, char **argv)
falco_logger::log(LOG_ERR, "Unable to load the driver.\n");
}
open_f(inspector);
}
else
}
else
{
rethrow_exception(current_exception());
}
@@ -1281,7 +1289,7 @@ int falco_init(int argc, char **argv)
if(!trace_filename.empty() && !trace_is_scap)
{
#ifndef MINIMAL_BUILD
#ifndef MINIMAL_BUILD
read_k8s_audit_trace_file(engine,
outputs,
trace_filename);