Skip to content

Commit

Permalink
Cleanup comments and error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
pondzix committed Nov 6, 2024
1 parent fc25a59 commit 418a6bb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion pkg/target/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,6 @@ func (ht *HTTPTarget) Write(messages []*models.Message) (*models.TargetWriteResu

if findMatchingRule(response, ht.responseRules.Invalid) != nil {
for _, msg := range goodMsgs {
// can we use response body as an error message for invalid data?
msg.SetError(errors.New(response.Body))
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/transform/filter/jq_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package filter

import (
"errors"
"fmt"

"github.com/snowplow/snowbridge/config"
"github.com/snowplow/snowbridge/pkg/models"
Expand Down Expand Up @@ -52,9 +53,8 @@ func filterOutput(jqOutput transform.JqCommandOutput) transform.TransformationFu
return func(message *models.Message, interState interface{}) (*models.Message, *models.Message, *models.Message, interface{}) {
shouldKeepMessage, isBoolean := jqOutput.(bool)

// maybe crash instead?
if !isBoolean {
message.SetError(errors.New("jq filter doesn't evaluate to boolean value"))
message.SetError(fmt.Errorf("jq filter returned '%v'; expected boolean", jqOutput))
return nil, nil, message, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/transform/filter/jq_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func TestJQFilter_non_boolean_output(t *testing.T) {

assert.Empty(kept)
assert.Empty(dropped)
assert.Equal("jq filter doesn't evaluate to boolean value", invalid.GetError().Error())
assert.Equal("jq filter returned '1557499235'; expected boolean", invalid.GetError().Error())
}

func TestJQFilter_invalid_jq_command(t *testing.T) {
Expand Down

0 comments on commit 418a6bb

Please sign in to comment.