summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keystoneclient/client.py1
-rw-r--r--keystoneclient/exceptions.py5
2 files changed, 4 insertions, 2 deletions
diff --git a/keystoneclient/client.py b/keystoneclient/client.py
index 625e33b..afdb5c2 100644
--- a/keystoneclient/client.py
+++ b/keystoneclient/client.py
@@ -125,6 +125,7 @@ class HTTPClient(httplib2.Http):
body = None
if resp.status in (400, 401, 403, 404, 408, 409, 413, 500, 501):
+ _logger.exception("Request returned failure status.")
raise exceptions.from_response(resp, body)
elif resp.status in (301, 302, 305):
# Redirected. Reissue the request to the new location.
diff --git a/keystoneclient/exceptions.py b/keystoneclient/exceptions.py
index 8f8ea57..eeefe98 100644
--- a/keystoneclient/exceptions.py
+++ b/keystoneclient/exceptions.py
@@ -118,12 +118,13 @@ def from_response(response, body):
"""
cls = _code_map.get(response.status, ClientException)
if body:
- message = "n/a"
- details = "n/a"
if hasattr(body, 'keys'):
error = body[body.keys()[0]]
message = error.get('message', None)
details = error.get('details', None)
+ else:
+ message = body
+ details = None
return cls(code=response.status, message=message, details=details)
else:
return cls(code=response.status)