From 4956f798fb978be62762a3a205694df14a52d1e1 Mon Sep 17 00:00:00 2001 From: Andrii Shyshkalov Date: Mon, 10 Apr 2017 14:28:38 +0200 Subject: [PATCH] git cl: suggest git cl creds-check if Gerrit API returns 401. R=sergiyb@chromium.org BUG=708785 Change-Id: Id25d3ef9a1449a0c259ed48b782e1b766e1a5fc9 Reviewed-on: https://chromium-review.googlesource.com/472906 Reviewed-by: Sergiy Byelozyorov Commit-Queue: Andrii Shyshkalov --- gerrit_util.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gerrit_util.py b/gerrit_util.py index 27f64009b..0aef46d7b 100755 --- a/gerrit_util.py +++ b/gerrit_util.py @@ -368,6 +368,9 @@ def ReadHttpResponse(conn, expect_status=200, ignore_404=True): if ignore_404 and response.status == 404: return StringIO() if response.status != expect_status: + if response.status in (401, 403): + print('Your Gerrit credentials might be misconfigured. Try: \n' + ' git cl creds-check') reason = '%s: %s' % (response.reason, contents) raise GerritError(response.status, reason) return StringIO(contents)