diff --git a/openstackclient/common/exceptions.py b/openstackclient/common/exceptions.py index ee0f7a110..5f81e6a6e 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)