Skip to content

Commit 9e7f0cf

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Remove unused method 'from_response'"
2 parents 8233b92 + 848d531 commit 9e7f0cf

1 file changed

Lines changed: 0 additions & 25 deletions

File tree

openstackclient/common/exceptions.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -108,28 +108,3 @@ class HTTPNotImplemented(ClientException):
108108
OverLimit,
109109
HTTPNotImplemented
110110
])
111-
112-
113-
def from_response(response, body):
114-
"""Return an instance of a ClientException based on an httplib2 response.
115-
116-
Usage::
117-
118-
resp, body = http.request(...)
119-
if resp.status != 200:
120-
raise exception_from_response(resp, body)
121-
"""
122-
cls = _code_map.get(response.status, ClientException)
123-
if body:
124-
if hasattr(body, 'keys'):
125-
error = body[list(body.keys())[0]]
126-
message = error.get('message')
127-
details = error.get('details')
128-
else:
129-
# If we didn't get back a properly formed error message we
130-
# probably couldn't communicate with Keystone at all.
131-
message = "Unable to communicate with image service: %s." % body
132-
details = None
133-
return cls(code=response.status, message=message, details=details)
134-
else:
135-
return cls(code=response.status)

0 commit comments

Comments
 (0)