Skip to content

Commit e6285c1

Browse files
committed
Show nicer error message when loading repo failed.
1 parent 0f5983d commit e6285c1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

git-pull-request

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,12 @@ def show():
122122
print
123123
url = "http://github.com/api/v2/json/pulls/%s/open" % (repo)
124124
req = urllib2.Request(url)
125-
response = urllib2.urlopen(req)
125+
try:
126+
response = urllib2.urlopen(req)
127+
except urllib2.HTTPError, msg:
128+
print "error loading pull requests for repo %s: %s" % (repo, msg)
129+
exit(1)
130+
126131
data = response.read()
127132
if (data == ''):
128133
print "failed to speak with github."
@@ -150,7 +155,6 @@ def fetch(pullreq):
150155
return 3
151156

152157
data = json.loads(data)
153-
#print json.dumps(data,sort_keys=True, indent=4)
154158
pr = data['pull']
155159
display(pr)
156160

0 commit comments

Comments
 (0)