Adapt http response error message parsing

Due I05d2bb60b211d1b18611070217b01e3e418eb79a, change the error message
parsing to get error message from response.

Closes-Bug: #1555985
Change-Id: I4da3aff76fe46d1ac9fd90e06cb4931dc9a8d203
(cherry picked from commit e9c6c1a2a3)
This commit is contained in:
Eli Qiao
2016-03-11 17:05:35 +08:00
committed by Hongbin Lu
parent c991639a6b
commit 3ec6806e14

View File

@@ -44,6 +44,12 @@ def _extract_error_json(body):
if 'error_message' in body_json:
raw_msg = body_json['error_message']
error_json = json.loads(raw_msg)
else:
error_body = body_json['errors'][0]
raw_msg = error_body['title']
error_json = {'faultstring': error_body['title'],
'debuginfo': error_body['detail']}
except ValueError:
return {}