Skip to content

Commit

Permalink
Bug #884018: "stack help" prints stacktrace if it cannot connect to t…
Browse files Browse the repository at this point in the history
…he server

Add a handler for URLError, so that we print a nicer error message if stack
cannot connect to the server.

Change-Id: I24f977dcb12bee3bb21057fe9b19823d98581141
  • Loading branch information
Ewan Mellor committed Oct 30, 2011
1 parent 5b8133a commit 0f7f91c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bin/stack
Expand Up @@ -118,6 +118,9 @@ def do_request(controller, method, params=None):
req = urllib2.Request(url, data, headers)
try:
resp = urllib2.urlopen(req)
except urllib2.URLError, e:
print 'Failed to connect to %s: %s' % (url, e.reason)
sys.exit(1)
except urllib2.HTTPError, e:
print e.read()
sys.exit(1)
Expand Down

0 comments on commit 0f7f91c

Please sign in to comment.