Skip to content

Commit

Permalink
scripts/ci/gitlab-pipeline-status: give more information on failures
Browse files Browse the repository at this point in the history
When an HTTP GET request fails, it's useful to go beyond the "not
successful" message, and show the code returned by the server.

Signed-off-by: Cleber Rosa <[email protected]>
Reviewed-by: Alex Bennée <[email protected]>
Reviewed-by: Wainer dos Santos Moschetta <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
  • Loading branch information
clebergnu authored and huth committed Mar 9, 2021
1 parent 2faf56b commit 861d1d5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/ci/gitlab-pipeline-status
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def get_json_http_response(url):
connection.request('GET', url=url)
response = connection.getresponse()
if response.code != http.HTTPStatus.OK:
raise CommunicationFailure("Failed to receive a successful response")
msg = "Received unsuccessful response: %s (%s)" % (response.code,
response.reason)
raise CommunicationFailure(msg)
return json.loads(response.read())


Expand Down

0 comments on commit 861d1d5

Please sign in to comment.