mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-08 19:34:18 +00:00
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.
This commit is contained in:
parent
ec86563326
commit
c79230c854
@ -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":
|
||||
|
Loading…
x
Reference in New Issue
Block a user