summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-03-29 16:33:04 +0000
committerGerrit Code Review <review@openstack.org>2016-03-29 16:33:04 +0000
commit9e7f0cf1a544e13d472f49b64d1c5320f6f8d08c (patch)
tree0896e03bc58c24512c87e8a8a2ba93479656bd9a /openstackclient
parent8233b923f1cf8b917a0fafefd727477720c7ae77 (diff)
parent848d5312fffa358a789a46a8657af3a92cb3ef6f (diff)
downloadpython-openstackclient-9e7f0cf1a544e13d472f49b64d1c5320f6f8d08c.tar.gz
Merge "Remove unused method 'from_response'"
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/common/exceptions.py25
1 files changed, 0 insertions, 25 deletions
diff --git a/openstackclient/common/exceptions.py b/openstackclient/common/exceptions.py
index ee0f7a11..5f81e6a6 100644
--- a/openstackclient/common/exceptions.py
+++ b/openstackclient/common/exceptions.py
@@ -108,28 +108,3 @@ _code_map = dict((c.http_status, c) for c in [
OverLimit,
HTTPNotImplemented
])
-
-
-def from_response(response, body):
- """Return an instance of a ClientException based on an httplib2 response.
-
- Usage::
-
- resp, body = http.request(...)
- if resp.status != 200:
- raise exception_from_response(resp, body)
- """
- cls = _code_map.get(response.status, ClientException)
- if body:
- if hasattr(body, 'keys'):
- error = body[list(body.keys())[0]]
- message = error.get('message')
- details = error.get('details')
- else:
- # If we didn't get back a properly formed error message we
- # probably couldn't communicate with Keystone at all.
- message = "Unable to communicate with image service: %s." % body
- details = None
- return cls(code=response.status, message=message, details=details)
- else:
- return cls(code=response.status)