Handle xreply parsing errors more gracefully

This commit is contained in:
kimth
2012-08-06 17:44:07 -04:00
parent b6e9e7a4bb
commit 18a7f58735

View File

@@ -47,7 +47,12 @@ def parse_xreply(xreply):
'content': Message from xqueue (string)
}
'''
xreply = json.loads(xreply)
try:
xreply = json.loads(xreply)
except ValueError, err:
log.error(err)
return (1, 'unexpected reply from server')
return_code = xreply['return_code']
content = xreply['content']
return (return_code, content)