From f00e0ce556fc22fef180c74a9d78f1908d9aeb0b Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sat, 22 Aug 2009 18:39:49 -0700 Subject: upload: Catch and cleanly report connectivity errors Instead of giving a Python backtrace when there is a connectivity problem during repo upload, report that we cannot access the host, and why, with a halfway decent error message. Bug: REPO-45 Change-Id: I9a45b387e86e48073a2d99bd6d594c1a7d6d99d4 Signed-off-by: Shawn O. Pearce (cherry picked from commit d2dfac81ad6a060179b4b2289060af2dc7a5cdfd) --- subcmds/upload.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'subcmds/upload.py') diff --git a/subcmds/upload.py b/subcmds/upload.py index 1964bffa..20822096 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py @@ -283,15 +283,19 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ have_errors = True print >>sys.stderr, '' - print >>sys.stderr, '--------------------------------------------' + print >>sys.stderr, '----------------------------------------------------------------------' if have_errors: for branch in todo: if not branch.uploaded: - print >>sys.stderr, '[FAILED] %-15s %-15s (%s)' % ( + if len(str(branch.error)) <= 30: + fmt = ' (%s)' + else: + fmt = '\n (%s)' + print >>sys.stderr, ('[FAILED] %-15s %-15s' + fmt) % ( branch.project.relpath + '/', \ branch.name, \ - branch.error) + str(branch.error)) print >>sys.stderr, '' for branch in todo: -- cgit v1.2.3-54-g00ecf