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):
|
def _raise_api_exception(self, resp):
|
||||||
try:
|
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:
|
except ValueError:
|
||||||
error_data = resp.content
|
error_data = resp.content
|
||||||
raise APIException(error_code=resp.status_code,
|
raise APIException(error_code=resp.status_code,
|
||||||
|
@@ -24,6 +24,7 @@ class FakeResponse(object):
|
|||||||
def __init__(self, status_code, content=None):
|
def __init__(self, status_code, content=None):
|
||||||
self.status_code = status_code
|
self.status_code = status_code
|
||||||
self.content = content
|
self.content = content
|
||||||
|
self.headers = {}
|
||||||
|
|
||||||
def json(self):
|
def json(self):
|
||||||
return json.loads(self.content)
|
return json.loads(self.content)
|
||||||
|
Reference in New Issue
Block a user