fix(userspace/engine): solve integration test errors

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
Jason Dellaluce
2022-04-06 16:02:55 +00:00
committed by poiana
parent c0f8171d89
commit e50d22f013

View File

@@ -587,19 +587,22 @@ bool rule_loader::read(const string &content, falco_engine* engine,
}
for(auto it = doc->begin(); it != doc->end(); it++)
{
string ctx = yaml_format_object(content, docs, doc, it);
YAML::Node item = *it;
try
if (!it->IsNull())
{
THROW(!item.IsMap(), "Unexpected element type. "
"Each element should be a yaml associative array.");
item["context"] = ctx;
read_item(engine, item, warnings);
}
catch(const exception& e)
{
errors.push_back(ctxerr(ctx, e.what()));
return false;
string ctx = yaml_format_object(content, docs, doc, it);
YAML::Node item = *it;
try
{
THROW(!item.IsMap(), "Unexpected element type. "
"Each element should be a yaml associative array.");
item["context"] = ctx;
read_item(engine, item, warnings);
}
catch(const exception& e)
{
errors.push_back(ctxerr(ctx, e.what()));
return false;
}
}
}
}