From 5f936568c3132b78c0601bdfc2d9a6cbb674a481 Mon Sep 17 00:00:00 2001 From: Andy Grunwald Date: Sun, 9 Sep 2018 18:13:48 +0200 Subject: [PATCH] Fixed handling of unhandled error --- changes.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/changes.go b/changes.go index 8fdea37..f9cbf49 100644 --- a/changes.go +++ b/changes.go @@ -780,8 +780,15 @@ func (s *ChangesService) change(tail string, changeID string, input interface{}) v := new(ChangeInfo) resp, err := s.client.Do(req, v) + if err != nil { + return v, resp, err + } if resp.StatusCode == http.StatusConflict { - body, _ := ioutil.ReadAll(resp.Body) + var body []byte + body, err = ioutil.ReadAll(resp.Body) + if err != nil { + return v, resp, err + } err = errors.New(string(body[:])) } return v, resp, err