Skip to content

Commit

Permalink
improve error logs
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusfm committed Apr 3, 2023
1 parent 688400d commit aebd229
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/cmd/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (o *ScanOptions) getChecks() ([]types.Check, error) {
if *o.ChecksPath != "" {
localChecks, err := loader.LoadChecks(*o.ChecksPath)
if err != nil {
o.log.Error(err, "load checks error", "path", *o.ChecksPath)
o.log.Error(err, "failed to load checks", "path", *o.ChecksPath)
return nil, fmt.Errorf("load checks error: %s", err.Error())
}
o.log.V(2).Info("custom checks loaded", "total", len(localChecks))
Expand All @@ -209,7 +209,7 @@ func (o *ScanOptions) runCheck(check types.Check) *types.CheckResult {
defer cr.UpdateStatus()
v, err := validator.Compile(check, o.apiResources, o.kubeVersion)
if err != nil {
log.Error(err, "compile error")
log.Error(err, "failed to compile check "+check.ID)
cr.AddError(fmt.Errorf("%s compile error: %s", check.Path, err.Error()))
return cr
}
Expand All @@ -227,7 +227,7 @@ func (o *ScanOptions) runCheck(check types.Check) *types.CheckResult {
}
passed, _, err := v.Validate(obj, check.Params)
if err != nil {
log.Error(err, "validate error")
log.Error(err, "failed to validate check "+check.ID)
cr.AddError(fmt.Errorf("%s validate error: %s", check.Path, err.Error()))
continue
}
Expand Down

0 comments on commit aebd229

Please sign in to comment.