Browse Source

[beeswax] Raise an exception if the beeswax query failed

Erick Tryzelaar 10 years ago
parent
commit
4b9dee3
1 changed files with 9 additions and 0 deletions
  1. 9 0
      apps/beeswax/src/beeswax/test_base.py

+ 9 - 0
apps/beeswax/src/beeswax/test_base.py

@@ -193,6 +193,10 @@ def wait_for_query_to_finish(client, response, max=60.0):
     return response
 
   content = json.loads(response.content)
+
+  if content.get('status') == -1:
+    raise Exception('Query failed: %s' % content.get('message'))
+
   watch_url = content['watch_url']
 
   response = client.get(watch_url, follow=True)
@@ -208,6 +212,11 @@ def wait_for_query_to_finish(client, response, max=60.0):
 
     response = client.get(watch_url, follow=True)
 
+  content = json.loads(response.content)
+
+  if content.get('status') == -1:
+    raise Exception('Query failed: %s' % content.get('message'))
+
   return response