From 18a7f587354558bb144efb76e5342ef8ca107365 Mon Sep 17 00:00:00 2001 From: kimth Date: Mon, 6 Aug 2012 17:44:07 -0400 Subject: [PATCH] Handle xreply parsing errors more gracefully --- common/lib/capa/capa/xqueue_interface.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/lib/capa/capa/xqueue_interface.py b/common/lib/capa/capa/xqueue_interface.py index f69c9142e8..82e4fba5cc 100644 --- a/common/lib/capa/capa/xqueue_interface.py +++ b/common/lib/capa/capa/xqueue_interface.py @@ -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)