From b073999c6f90103a36a923e63ae8cf7a5c9c6c8c Mon Sep 17 00:00:00 2001 From: Edward Lesmes Date: Fri, 9 Oct 2020 23:15:44 +0000 Subject: [PATCH] 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 Commit-Queue: Edward Lesmes --- gerrit_util.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gerrit_util.py b/gerrit_util.py index 0077f5f0b..d91312a05 100644 --- a/gerrit_util.py +++ b/gerrit_util.py @@ -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)...',