Get ready for the structured exceptions coming in es 2.0
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user