
commit 46edf49c7cb8ceaf09ec8fbd84aae870eb82aeff Author: David Fifield <david@bamsoftware.com> Date: Fri Jul 6 06:46:32 2012 -0700 Catch a POST error, print an error message, exit with nonzero status. --- flashproxy-reg-http.py | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/flashproxy-reg-http.py b/flashproxy-reg-http.py index 8892fb2..209f77e 100755 --- a/flashproxy-reg-http.py +++ b/flashproxy-reg-http.py @@ -101,7 +101,11 @@ else: spec = format_addr(options.remote_addr) http = httplib.HTTPConnection(*options.facilitator_addr) -http.request("POST", "/", urllib.urlencode({"client": spec})) +try: + http.request("POST", "/", urllib.urlencode({"client": spec})) +except Exception, e: + print >> sys.stderr, "Failed to register: %s" % str(e) + sys.exit(1) http.close() print "Registered \"%s\" with %s." % (spec, format_addr(options.facilitator_addr))