Skip to content

Commit

Permalink
🐛 log yaml parsing errors when parsing rules (#509)
Browse files Browse the repository at this point in the history
fixes #476

---------

Signed-off-by: vickysomtee <[email protected]>
  • Loading branch information
Vickysomtee authored Feb 20, 2024
1 parent 6c8c947 commit ff08ad0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions parser/rule_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func (r *RuleParser) LoadRules(filepath string) ([]engine.RuleSet, map[string]pr
if info.Mode().IsRegular() {
rules, m, err := r.LoadRule(filepath)
if err != nil {
r.Log.V(8).Error(err, "unable to load rule set")
return nil, nil, err
}

Expand Down Expand Up @@ -180,6 +181,8 @@ func (r *RuleParser) LoadRule(filepath string) ([]engine.Rule, map[string]provid
// Assume that there is a rule set header.
err = yaml.Unmarshal(content, &ruleMap)
if err != nil {
r.Log.V(8).Error(err, fmt.Sprintf("unable to load rule set - failed to convert file: %s to yaml", filepath))

return nil, nil, fmt.Errorf("unable to convert file: %s to yaml", filepath)
}

Expand Down

0 comments on commit ff08ad0

Please sign in to comment.