mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-06-19 12:34:17 +00:00
Use modern Python exception syntax
"except Exception as e" instead of "except Exception, e" This is part of a transition to supporting Python 3. Python >= 2.6 support "as" syntax. Note: this removes Python 2.5 support. Change-Id: I309599f3981bba2b46111c43102bee38ff132803
This commit is contained in:
@ -207,7 +207,7 @@ to update the working directory files.
|
||||
|
||||
try:
|
||||
self.manifest.Link(name)
|
||||
except ManifestParseError, e:
|
||||
except ManifestParseError as e:
|
||||
print >>sys.stderr, "fatal: manifest '%s' not available" % name
|
||||
print >>sys.stderr, 'fatal: %s' % str(e)
|
||||
sys.exit(1)
|
||||
|
@ -417,7 +417,7 @@ uncommitted changes are present' % project.relpath
|
||||
# in the .netrc file.
|
||||
print >>sys.stderr, 'No credentials found for %s in .netrc' % \
|
||||
parse_result.hostname
|
||||
except netrc.NetrcParseError, e:
|
||||
except netrc.NetrcParseError as e:
|
||||
print >>sys.stderr, 'Error parsing .netrc file: %s' % e
|
||||
|
||||
if (username and password):
|
||||
@ -464,11 +464,11 @@ uncommitted changes are present' % project.relpath
|
||||
else:
|
||||
print >>sys.stderr, 'error: %s' % manifest_str
|
||||
sys.exit(1)
|
||||
except (socket.error, IOError, xmlrpclib.Fault), e:
|
||||
except (socket.error, IOError, xmlrpclib.Fault) as e:
|
||||
print >>sys.stderr, 'error: cannot connect to manifest server %s:\n%s' % (
|
||||
self.manifest.manifest_server, e)
|
||||
sys.exit(1)
|
||||
except xmlrpclib.ProtocolError, e:
|
||||
except xmlrpclib.ProtocolError as e:
|
||||
print >>sys.stderr, 'error: cannot connect to manifest server %s:\n%d %s' % (
|
||||
self.manifest.manifest_server, e.errcode, e.errmsg)
|
||||
sys.exit(1)
|
||||
|
@ -329,7 +329,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
|
||||
|
||||
branch.UploadForReview(people, auto_topic=opt.auto_topic, draft=opt.draft)
|
||||
branch.uploaded = True
|
||||
except UploadError, e:
|
||||
except UploadError as e:
|
||||
branch.error = e
|
||||
branch.uploaded = False
|
||||
have_errors = True
|
||||
@ -384,7 +384,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
|
||||
pending_proj_names = [project.name for (project, avail) in pending]
|
||||
try:
|
||||
hook.Run(opt.allow_all_hooks, project_list=pending_proj_names)
|
||||
except HookError, e:
|
||||
except HookError as e:
|
||||
print >>sys.stderr, "ERROR: %s" % str(e)
|
||||
return
|
||||
|
||||
|
Reference in New Issue
Block a user