From: Zooko O'Whielacronx Date: Sat, 20 Dec 2008 14:49:18 +0000 (-0700) Subject: cli: if response code from wapi server is not 200 then stop instead of proceeding X-Git-Url: https://git.rkrishnan.org/vdrive/%22file:/quickstart.html?a=commitdiff_plain;h=c79230c854fd8369187da1ea280fae78fb3ef2e8;p=tahoe-lafs%2Ftahoe-lafs.git cli: if response code from wapi server is not 200 then stop instead of proceeding Also, include the data that failed to json parse in an exception raised by the json parser. --- diff --git a/src/allmydata/scripts/tahoe_ls.py b/src/allmydata/scripts/tahoe_ls.py index d0d63799..88e09a47 100644 --- a/src/allmydata/scripts/tahoe_ls.py +++ b/src/allmydata/scripts/tahoe_ls.py @@ -30,13 +30,22 @@ def list(options): print >>stderr, "Error during GET: %s %s %s" % (resp.status, resp.reason, resp.read()) + if resp.status == 0: + return 3 + else: + return resp.status + data = resp.read() if options['json']: print >>stdout, data return - parsed = simplejson.loads(data) + try: + parsed = simplejson.loads(data) + except Exception, le: + le.args = tuple(le.args + (data,)) + raise nodetype, d = parsed children = {} if nodetype == "dirnode":