git-cl: Print response content on Gerrit transient errors.

Response contents contain useful information when debugging Gerrit
transient errors.

For example, trying to land a WIP CL fails with a 409 Conflict status,
which is not very useful when trying to troubleshoot.
The message returned by Gerrit makes it clearer:

  Failed to submit 1 change due to the following problems:
  Change XXXXXXX: Change XXXXXXX is work in progress

Bug: 1136295
Change-Id: I7e0036785cb3146eae49e29d3c4fa3e156ae7c20
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2463987
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
changes/87/2463987/3
Edward Lesmes 5 years ago committed by LUCI CQ
parent d7d0b90f7d
commit b073999c6f

@ -453,10 +453,12 @@ def ReadHttpResponse(conn, accept_statuses=frozenset([200])):
http_version = 'HTTP/%s' % ('1.1' if response.version == 11 else '1.0')
LOGGER.warn('A transient error occurred while querying %s:\n'
'%s %s %s\n'
'%s %d %s',
'%s %d %s\n'
'%s',
conn.req_host, conn.req_params['method'],
conn.req_params['uri'],
http_version, http_version, response.status, response.reason)
http_version, http_version, response.status, response.reason,
contents)
if idx < TRY_LIMIT - 1:
LOGGER.info('Will retry in %d seconds (%d more times)...',

Loading…
Cancel
Save