From f6fc695409c00b0303eed77353f8de6d4d79c329 Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Tue, 25 Nov 2014 13:33:49 -0700 Subject: [PATCH] Update apiclient from oslo-incubator Update apiclient from oslo-incubator Change-Id: I25330c6a168a5af9349470a25b40add14a0738f2 --- magnumclient/openstack/common/apiclient/exceptions.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/magnumclient/openstack/common/apiclient/exceptions.py b/magnumclient/openstack/common/apiclient/exceptions.py index 0aa627fc..341ac3a4 100644 --- a/magnumclient/openstack/common/apiclient/exceptions.py +++ b/magnumclient/openstack/common/apiclient/exceptions.py @@ -452,13 +452,10 @@ def from_response(response, method, url): except ValueError: pass else: - if isinstance(body, dict): - error = body.get(list(body)[0]) - if isinstance(error, dict): - kwargs["message"] = (error.get("message") or - error.get("faultstring")) - kwargs["details"] = (error.get("details") or - six.text_type(body)) + 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/"): kwargs["details"] = response.text