Skip to content

Commit

Permalink
Unmarshal error is an GET_INTERNAL_SERVER error
Browse files Browse the repository at this point in the history
  • Loading branch information
guscarreon committed Nov 30, 2023
1 parent 74f808b commit 64d357e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backends/ignite.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (ig *IgniteBackend) Get(ctx context.Context, key string) (string, error) {
igniteResponse := getResponse{}

if unmarshalErr := json.Unmarshal(responseBytes, &igniteResponse); unmarshalErr != nil {
return "", fmt.Errorf("Unmarshal response error: %s; Response body: %s", unmarshalErr.Error(), string(responseBytes))
return "", utils.NewPBCError(utils.GET_INTERNAL_SERVER, fmt.Sprintf("Ignite response unmarshal error: %s; Response body: %s", unmarshalErr.Error(), string(responseBytes)))
}

// Validate response
Expand Down
2 changes: 1 addition & 1 deletion backends/ignite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ func TestIgniteGet(t *testing.T) {
igniteError: nil,
},
expected: testOutput{
err: errors.New("Unmarshal response error: invalid character 'm' looking for beginning of value; Response body: malformed"),
err: utils.NewPBCError(utils.GET_INTERNAL_SERVER, "Ignite response unmarshal error: invalid character 'm' looking for beginning of value; Response body: malformed"),
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ request_limits:
max_num_values: 10
max_ttl_seconds: 3600
backend:
type: "memory" # Switch to be "aerospike", "cassandra", "memcache" or "redis" for production.
type: "memory" # Switch to be "aerospike", "cassandra", "memcache", "ignite" or "redis" for production.
aerospike:
hosts: [ "aerospike.prebid.com" ]
port: 3000
Expand Down

0 comments on commit 64d357e

Please sign in to comment.