1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-03-05 15:15:44 +02:00

Print "Status" in error case in http client (#1256)

This might provide useful context to the user.

For example when you try to upload a SNAPSHOT jar to a maven-release
repo in nexus, this will print an error like

returned with response 400 Repository version policy: RELEASE does
not allow version: 1.0-SNAPSHOT

instead of

returned with HTTP Code 400
This commit is contained in:
Florian Wilhelm 2020-03-09 19:25:40 +01:00 committed by GitHub
parent 6edaaecf15
commit fdb9fd3c6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -199,7 +199,7 @@ func (c *Client) handleResponse(response *http.Response) (*http.Response, error)
c.logger.WithField("HTTP Error", "500 (Internal Server Error)").Error("Unknown error occured.")
}
return response, fmt.Errorf("Request to %v returned with HTTP Code %v", response.Request.URL, response.StatusCode)
return response, fmt.Errorf("Request to %v returned with response %v", response.Request.URL, response.Status)
}
func (c *Client) applyDefaults() {