Skip to content

Commit

Permalink
Merge pull request #17282 from mtrmac/PodRmReport
Browse files Browse the repository at this point in the history
Log data that we failed to unmarshal
  • Loading branch information
openshift-merge-robot authored Jan 31, 2023
2 parents 56b9476 + 7c60a78 commit ddd8a61
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/bindings/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var (

func handleError(data []byte, unmarshalErrorInto interface{}) error {
if err := json.Unmarshal(data, unmarshalErrorInto); err != nil {
return err
return fmt.Errorf("unmarshaling error into %#v, data %q: %w", unmarshalErrorInto, string(data), err)
}
return unmarshalErrorInto.(error)
}
Expand All @@ -35,7 +35,10 @@ func (h APIResponse) ProcessWithError(unmarshalInto interface{}, unmarshalErrorI
}
if h.IsSuccess() || h.IsRedirection() {
if unmarshalInto != nil {
return json.Unmarshal(data, unmarshalInto)
if err := json.Unmarshal(data, unmarshalInto); err != nil {
return fmt.Errorf("unmarshaling into %#v, data %q: %w", unmarshalInto, string(data), err)
}
return nil
}
return nil
}
Expand Down

0 comments on commit ddd8a61

Please sign in to comment.