From ab914fad1eda7453f5140265e2bfc103b643e526 Mon Sep 17 00:00:00 2001 From: Josip Sokcevic Date: Fri, 17 May 2024 21:41:43 +0000 Subject: [PATCH] Improve cloudtop error message on git cl failure R=gavinmak@google.com Fixed: 280621923 Change-Id: I856dc1eb4f3fcd65906196b66f358b1dd413012e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5547690 Auto-Submit: Josip Sokcevic Commit-Queue: Gavin Mak Reviewed-by: Gavin Mak Commit-Queue: Josip Sokcevic --- gerrit_util.py | 2 +- git_cl.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/gerrit_util.py b/gerrit_util.py index c7555e5e7..39c3aef6d 100644 --- a/gerrit_util.py +++ b/gerrit_util.py @@ -511,7 +511,7 @@ def ReadHttpJsonResponse(conn, accept_statuses=frozenset([200])): # The first line of the response should always be: )]}' s = fh.readline() if s and s.rstrip() != ")]}'": - raise GerritError(200, 'Unexpected json output: %s' % s) + raise GerritError(200, 'Unexpected json output: %s' % s[:100]) s = fh.read() if not s: return None diff --git a/git_cl.py b/git_cl.py index c04defad8..ead1cd1f9 100755 --- a/git_cl.py +++ b/git_cl.py @@ -6862,6 +6862,8 @@ def main(argv): dispatcher = subcommand.CommandDispatcher(__name__) try: return dispatcher.execute(OptionParser(), argv) + except gerrit_util.GerritError as e: + DieWithError(str(e)) except auth.LoginRequiredError as e: DieWithError(str(e)) except urllib.error.HTTPError as e: