From ea4a5bd47b593f73659c222349ff0ed7960d3f0f Mon Sep 17 00:00:00 2001 From: Fabio Bonelli Date: Fri, 17 Jun 2022 21:29:19 +0200 Subject: [PATCH] Don't print on errors. Don't print on errors so consumers of the library can control what they show to the users. --- client.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/client.go b/client.go index 6462bc5..e7f2ffd 100644 --- a/client.go +++ b/client.go @@ -331,8 +331,7 @@ func (c *Client) doRequest(req *http.Request, emptyResponse bool) (interface{}, var result interface{} if err := json.Unmarshal(responseBytes, &result); err != nil { - log.Println("Could not unmarshal JSON payload, returning raw response") - return responseBytes, nil + return responseBytes, err } return result, nil } @@ -388,7 +387,6 @@ func (c *Client) doPaginatedRequest(req *http.Request, emptyResponse bool) (inte var result interface{} if err := json.Unmarshal(responseBytes, &result); err != nil { - log.Println("Could not unmarshal JSON payload, returning raw response") return resBody, err } return result, nil