Skip to content

Commit

Permalink
fix: add details to change exclusion error
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Oct 9, 2024
1 parent dd5f315 commit 80479f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion api/v1/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ func (r ChangeResult) PatchesMap() map[string]any {
}

func (c ChangeResult) String() string {
return fmt.Sprintf("%s/%s: %s", c.ConfigType, c.ExternalID, c.ChangeType)
if c.ConfigID == "" {
return fmt.Sprintf("{%s/%s}, {%s/%s}", c.ConfigType, c.ExternalID, c.ChangeType, c.ExternalChangeID)
}

return fmt.Sprintf("{%s}, {%s/%s}", c.ConfigID, c.ChangeType, c.ExternalChangeID)
}

func (result AnalysisResult) String() string {
Expand Down
2 changes: 1 addition & 1 deletion db/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func shouldExcludeChange(result *v1.ScrapeResult, changeResult v1.ChangeResult)

for _, expr := range exclusions {
if res, err := gomplate.RunTemplate(env, gomplate.Template{Expression: expr}); err != nil {
return false, fmt.Errorf("failed to evaluate change exclusion expression(%s): %w", expr, err)
return false, fmt.Errorf("[%s] change exclusion expression failed (%s): %w", changeResult, expr, err)
} else if skipChange, err := strconv.ParseBool(res); err != nil {
return false, fmt.Errorf("change exclusion expression(%s) didn't evaluate to a boolean: %w", expr, err)
} else if skipChange {
Expand Down

0 comments on commit 80479f6

Please sign in to comment.