diff options
| author | Wenzhi Yu <wenzhi_yu@163.com> | 2016-03-29 17:20:05 +0800 |
|---|---|---|
| committer | Wenzhi Yu <wenzhi_yu@163.com> | 2016-03-29 17:28:24 +0800 |
| commit | 848d5312fffa358a789a46a8657af3a92cb3ef6f (patch) | |
| tree | 2c5fa53e0846cc8fdd0968307626b3e8d0fed963 /openstackclient/common | |
| parent | 62a6a497bd757575f5192c27925d1e54e65dadcc (diff) | |
| download | python-openstackclient-848d5312fffa358a789a46a8657af3a92cb3ef6f.tar.gz | |
Remove unused method 'from_response'
'openstackclient.common.exceptions.from_response' method is never called
in openstackclient code base, so we should remove it.
Change-Id: I04254a4e66863942e6c273d77bbd66ce2ce7804c
Related-Bug: #1559072
Diffstat (limited to 'openstackclient/common')
| -rw-r--r-- | openstackclient/common/exceptions.py | 25 |
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) |
