Skip to content

Commit

Permalink
Add read stream error handler
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Felipe Dominguite <[email protected]>
  • Loading branch information
pdominguite committed Jan 6, 2021
1 parent 9d9469e commit c6d9f14
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/scalers/openstack/keystone_authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ func (authProps *KeystoneAuthMetadata) GetToken() (string, error) {
return resp.Header["X-Subject-Token"][0], nil
}

errBody, _ := ioutil.ReadAll(resp.Body)
errBody, readBodyErr := ioutil.ReadAll(resp.Body)

if readBodyErr != nil {
return "", readBodyErr
}

return "", fmt.Errorf(string(errBody))
}
Expand Down

0 comments on commit c6d9f14

Please sign in to comment.