summaryrefslogtreecommitdiff
path: root/keystoneclient/client.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-04-18 21:23:53 +0000
committerGerrit Code Review <review@openstack.org>2013-04-18 21:23:53 +0000
commitfc54b30e58e95fccba27f975fa3da3016630b414 (patch)
treee579c419bbd8163627dfc2db74124598e82dbd01 /keystoneclient/client.py
parente7e35f716b6e45b119db5dc478f6dc87a7867538 (diff)
parentd3583cad27b1f667965573a737e4c6e5971e4285 (diff)
downloadpython-keystoneclient-fc54b30e58e95fccba27f975fa3da3016630b414.tar.gz
Merge "Pass json object when invoking exception handler."
Diffstat (limited to 'keystoneclient/client.py')
-rw-r--r--keystoneclient/client.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/keystoneclient/client.py b/keystoneclient/client.py
index b9d4bc7..e3c2ed5 100644
--- a/keystoneclient/client.py
+++ b/keystoneclient/client.py
@@ -364,19 +364,10 @@ class HTTPClient(object):
self.http_log_resp(resp)
- if resp.status_code >= 400:
- _logger.debug(
- "Request returned failure status: %s",
- resp.status_code)
- raise exceptions.from_response(resp, resp.text)
- elif resp.status_code in (301, 302, 305):
- # Redirected. Reissue the request to the new location.
- return self.request(resp.headers['location'], method, **kwargs)
-
if resp.text:
try:
body = json.loads(resp.text)
- except ValueError:
+ except (ValueError, TypeError):
body = None
_logger.debug("Could not decode JSON from body: %s"
% resp.text)
@@ -384,6 +375,15 @@ class HTTPClient(object):
_logger.debug("No body was returned.")
body = None
+ if resp.status_code >= 400:
+ _logger.debug(
+ "Request returned failure status: %s",
+ resp.status_code)
+ raise exceptions.from_response(resp, body or resp.text)
+ elif resp.status_code in (301, 302, 305):
+ # Redirected. Reissue the request to the new location.
+ return self.request(resp.headers['location'], method, **kwargs)
+
return resp, body
def _cs_request(self, url, method, **kwargs):