mirror of
https://github.com/containers/podman.git
synced 2025-07-25 09:05:00 +08:00
Log data that we failed to unmarshal
This should never happen with a consistent client/server, and we are seeing this show up with some hard-to-diagnose flakes. So, log details about failures. After we find the cause, we might remove this extra logging again. [NO NEW TESTS NEEDED] Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
@ -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)
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user