Skip to content

Commit

Permalink
Merge pull request #56 from xuzhang3/addhttpstatuscode
Browse files Browse the repository at this point in the history
return http statusCode within WrapperError
  • Loading branch information
tedchamb authored Mar 27, 2020
2 parents 17093eb + 33b33ef commit 543de48
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions azuredevops/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ func (client *Client) UnwrapError(response *http.Response) (err error) {

var wrappedError WrappedError
err = json.Unmarshal(body, &wrappedError)
wrappedError.StatusCode = &response.StatusCode
if err != nil {
return err
}
Expand All @@ -389,10 +390,9 @@ func (client *Client) UnwrapError(response *http.Response) (err error) {
var wrappedImproperError WrappedImproperError
err = json.Unmarshal(body, &wrappedImproperError)
if err == nil && wrappedImproperError.Value != nil && wrappedImproperError.Value.Message != nil {
statusCode := response.StatusCode
return &WrappedError{
Message: wrappedImproperError.Value.Message,
StatusCode: &statusCode,
StatusCode: &response.StatusCode,
}
}
}
Expand Down

0 comments on commit 543de48

Please sign in to comment.