Skip to content

Commit

Permalink
Fixed handling of unhandled error
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrunwald committed Sep 10, 2018
1 parent eefac78 commit 5f93656
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5f93656

Please sign in to comment.