Sync oslo apiclient.exceptions module

Changes -
 * Handle non-openstack errors gracefully

Change-Id: I6a4fc3497aef829294d4e37850530bb455341a79
This commit is contained in:
Matthew Farrellee
2014-09-11 07:40:24 -04:00
parent 38db7fcd2a
commit 56254c171c

View File

@@ -447,8 +447,8 @@ def from_response(response, method, url):
except ValueError:
pass
else:
if isinstance(body, dict):
error = list(body.values())[0]
if isinstance(body, dict) and isinstance(body.get("error"), dict):
error = body["error"]
kwargs["message"] = error.get("message")
kwargs["details"] = error.get("details")
elif content_type.startswith("text/"):