Merge "Show exact error message when authentication falied instead of HTML body"
This commit is contained in:
@@ -135,7 +135,8 @@ class ResourceManager(object):
|
||||
|
||||
def _raise_api_exception(self, resp):
|
||||
try:
|
||||
error_data = get_json(resp).get("faultstring")
|
||||
error_data = (resp.headers.get("Server-Error-Message", None) or
|
||||
get_json(resp).get("faultstring"))
|
||||
except ValueError:
|
||||
error_data = resp.content
|
||||
raise APIException(error_code=resp.status_code,
|
||||
|
@@ -24,6 +24,7 @@ class FakeResponse(object):
|
||||
def __init__(self, status_code, content=None):
|
||||
self.status_code = status_code
|
||||
self.content = content
|
||||
self.headers = {}
|
||||
|
||||
def json(self):
|
||||
return json.loads(self.content)
|
||||
|
Reference in New Issue
Block a user