summaryrefslogtreecommitdiffstats
path: root/git_config.py
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2013-05-24 12:12:23 +0900
committerChirayu Desai <cdesai@cyanogenmod.org>2013-05-25 08:07:52 +0530
commitecf8f2b7c8e68ee78c5a90ecd8a9b48e73195b80 (patch)
tree58a1e2c6e9e1c4ea6d8147414dab358a24d45c14 /git_config.py
parent59bbb580e34bbc5dce76dacaad9ff94f21fa396f (diff)
downloadgit-repo-ecf8f2b7c8e68ee78c5a90ecd8a9b48e73195b80.tar.gz
Handle HTTPException when attempting to get ssh_info
The call to `urlopen` can raise `HTTPException`, but this is not caught which results in a python Traceback. Add handling of the exception. Because `HTTPException` and its derived classes do not have any message, print the name of the exception in the error message instead. Change-Id: Ic90fb4cc0e92702375cd976d4a03876c8ce8bffc
Diffstat (limited to 'git_config.py')
-rw-r--r--git_config.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/git_config.py b/git_config.py
index 431cd457..2270200c 100644
--- a/git_config.py
+++ b/git_config.py
@@ -40,6 +40,10 @@ else:
40from signal import SIGTERM 40from signal import SIGTERM
41from error import GitError, UploadError 41from error import GitError, UploadError
42from trace import Trace 42from trace import Trace
43if is_python3():
44 from http.client import HTTPException
45else:
46 from httplib import HTTPException
43 47
44from git_command import GitCommand 48from git_command import GitCommand
45from git_command import ssh_sock 49from git_command import ssh_sock
@@ -608,6 +612,8 @@ class Remote(object):
608 raise UploadError('%s: %s' % (self.review, str(e))) 612 raise UploadError('%s: %s' % (self.review, str(e)))
609 except urllib.error.URLError as e: 613 except urllib.error.URLError as e:
610 raise UploadError('%s: %s' % (self.review, str(e))) 614 raise UploadError('%s: %s' % (self.review, str(e)))
615 except HTTPException as e:
616 raise UploadError('%s: %s' % (self.review, e.__class__.__name__))
611 617
612 REVIEW_CACHE[u] = self._review_url 618 REVIEW_CACHE[u] = self._review_url
613 return self._review_url + self.projectname 619 return self._review_url + self.projectname