Get ready for the structured exceptions coming in es 2.0

This commit is contained in:
Honza Král
2015-04-27 20:40:55 +02:00
parent f910581f5e
commit 42b4cfd3aa
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -95,6 +95,8 @@ class Connection(object):
try:
additional_info = json.loads(raw_data)
error_message = additional_info.get('error', error_message)
if isinstance(error_message, dict) and 'type' in error_message:
error_message = error_message['type']
except:
# we don't care what went wrong
pass
@@ -168,7 +168,7 @@ class YamlTestCase(ElasticsearchTestCase):
if catch in CATCH_CODES:
self.assertEquals(CATCH_CODES[catch], exception.status_code)
elif catch[0] == '/' and catch[-1] == '/':
self.assertTrue(re.search(catch[1:-1], exception.error))
self.assertTrue(re.search(catch[1:-1], repr(exception.info)))
self.last_response = exception.info
def run_gt(self, action):