Convert add_remote to use GitReviewExceptions
By using the GitReviewException class and subclasses, the raised exceptions will be caught in main() and properly handled. One Exception can be converted to a CommandFailed exception, and the other is simple enough to not need a subclass of GitReviewException. Change-Id: Idb02d43fd480ab67493c757fb95431602239a55f
This commit is contained in:
parent
e31646b3f2
commit
4e40ede085
@ -332,7 +332,8 @@ def add_remote(scheme, hostname, port, project, remote):
|
||||
remote_url = make_remote_url(scheme, username, hostname, port, project)
|
||||
print("Trying again with %s" % remote_url)
|
||||
if not test_remote_url(remote_url):
|
||||
raise Exception("Could not connect to gerrit at %s" % remote_url)
|
||||
raise GitReviewException("Could not connect to gerrit at "
|
||||
"%s" % remote_url)
|
||||
asked_for_username = True
|
||||
|
||||
print("Creating a git remote called \"%s\" that maps to:" % remote)
|
||||
@ -341,7 +342,7 @@ def add_remote(scheme, hostname, port, project, remote):
|
||||
(status, remote_output) = run_command_status(cmd)
|
||||
|
||||
if status != 0:
|
||||
raise Exception("Error running %s" % cmd)
|
||||
raise CommandFailed(status, remote_output, cmd, {})
|
||||
|
||||
if asked_for_username:
|
||||
print()
|
||||
|
Loading…
x
Reference in New Issue
Block a user