Skip to content

Commit

Permalink
fix: Improve clarity of error messages in regexp filtering
Browse files Browse the repository at this point in the history
Signed-off-by: Sean O'Hair <sean.ohair@intel.com>
  • Loading branch information
seanohair22 committed Jun 29, 2023
1 parent 377d8bc commit 0cf7aa9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/transforms/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (f *Filter) FilterByResourceName(ctx interfaces.AppFunctionContext, data in
for _, name := range f.FilterValues {
item, err := regexp.Compile(name)
if err != nil {
return false, fmt.Errorf("bad regexp in filtering on pipeline '%s': %s", ctx.PipelineId(), err.Error())
return false, fmt.Errorf("bad regexp (%s) in filtering on pipeline '%s': %s", name, ctx.PipelineId(), err.Error())
}
if item.MatchString(reading.ResourceName) {
readingFilteredOut = true
Expand All @@ -149,7 +149,7 @@ func (f *Filter) FilterByResourceName(ctx interfaces.AppFunctionContext, data in
for _, name := range f.FilterValues {
item, err := regexp.Compile(name)
if err != nil {
return false, fmt.Errorf("bad regexp in filtering on pipeline '%s': %s", ctx.PipelineId(), err.Error())
return false, fmt.Errorf("bad regexp (%s) in filtering on pipeline '%s': %s", name, ctx.PipelineId(), err.Error())
}
if item.MatchString(reading.ResourceName) {
readingFilteredFor = true
Expand Down Expand Up @@ -203,7 +203,7 @@ func (f *Filter) doEventFilter(filterProperty string, value string, lc logger.Lo
for _, name := range f.FilterValues {
item, err := regexp.Compile(name)
if err != nil {
lc.Errorf("bad regexp in filtering in pipeline '%s' : %s", f.ctx.PipelineId(), err.Error())
lc.Errorf("bad regexp (%s) in filtering in pipeline '%s' : %s", name, f.ctx.PipelineId(), err.Error())
return false
}
if item.MatchString(value) {
Expand Down

0 comments on commit 0cf7aa9

Please sign in to comment.