Skip to content

Commit

Permalink
Error response: fix extended error logic (#135)
Browse files Browse the repository at this point in the history
Write extended error only if response body read was successful.
  • Loading branch information
ozerovandrei committed Sep 26, 2019
1 parent 2e81e1e commit 3b82e9b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions selvpcclient/selvpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ func (client *ServiceClient) DoRequest(ctx context.Context, method, path string,
if response.StatusCode >= 400 && response.StatusCode <= 599 {
extendedError, err := responseResult.ExtractErr()
if err != nil {
responseResult.Err = fmt.Errorf("selvpcclient: got the %d status code from the server: %s", response.StatusCode, extendedError)
} else {
responseResult.Err = fmt.Errorf("selvpcclient: got the %d status code from the server", response.StatusCode)
} else {
responseResult.Err = fmt.Errorf("selvpcclient: got the %d status code from the server: %s", response.StatusCode, extendedError)
}
}

Expand Down

0 comments on commit 3b82e9b

Please sign in to comment.