Merge "Show exact error message when authentication falied instead of HTML body"

This commit is contained in:
Jenkins
2015-10-09 07:22:24 +00:00
committed by Gerrit Code Review
2 changed files with 3 additions and 1 deletions

View File

@@ -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,

View File

@@ -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)