Commit ea4301e5 authored by Andrii Shyshkalov's avatar Andrii Shyshkalov Committed by Commit Bot

git cl upload: print response headers on 404 Gerrit RPC status.

R=ajp@chromium.org

Bug: 881860
Change-Id: I2a5fc981fce05664ea077cad74458bc38c37f1e7
Reviewed-on: https://chromium-review.googlesource.com/1227439
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
parent 45b20c41
...@@ -409,12 +409,26 @@ def ReadHttpResponse(conn, accept_statuses=frozenset([200])): ...@@ -409,12 +409,26 @@ def ReadHttpResponse(conn, accept_statuses=frozenset([200])):
break break
# A status >=500 is assumed to be a possible transient error; retry. # A status >=500 is assumed to be a possible transient error; retry.
http_version = 'HTTP/%s' % ('1.1' if response.version == 11 else '1.0') http_version = 'HTTP/%s' % ('1.1' if response.version == 11 else '1.0')
# TODO(crbug/881860): remove this special 404 handling.
if response.status == 404:
LOGGER.warn(
'404 NotFound error occurred while querying %s %s: %s\n'
'NOTE: if see this while running `git cl upload`,\n'
'consider reporting this to https://crbug.com/881860.\n'
'Please, include response headers below:\n'
' %s\n',
conn.req_params['method'], conn.req_params['uri'], response.reason,
'\n '.join(
json.dumps(response, sort_keys=True, indent=2).splitlines()))
else:
LOGGER.warn('A transient error occurred while querying %s:\n' LOGGER.warn('A transient error occurred while querying %s:\n'
'%s %s %s\n' '%s %s\n'
'%s %d %s', '%s %d %s\n',
conn.req_host, conn.req_params['method'], conn.req_host,
conn.req_params['uri'], conn.req_params['method'], conn.req_params['uri'],
http_version, http_version, response.status, response.reason) http_version, response.status, response.reason)
if TRY_LIMIT - idx > 1: if TRY_LIMIT - idx > 1:
LOGGER.info('Will retry in %d seconds (%d more times)...', LOGGER.info('Will retry in %d seconds (%d more times)...',
sleep_time, TRY_LIMIT - idx - 1) sleep_time, TRY_LIMIT - idx - 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment