Improved exception handling
The exception from response method behavior changed to match the fields that are returned from the API. This actually means changing oslo files which is not a recommended thing to do, but I see no other way to inject a custom error parsing to their code. Monkey-patching is worse option I think. Change-Id: I33b926b9541c3e16b256d7e7383fa65a89bb5642
This commit is contained in:
parent
232353e21f
commit
dd9c9a7c3c
@ -458,12 +458,10 @@ def from_response(response, method, url):
|
||||
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))
|
||||
kwargs["message"] = (body.get("message") or
|
||||
body.get("faultstring"))
|
||||
kwargs["details"] = (body.get("details") or
|
||||
six.text_type(body))
|
||||
elif content_type.startswith("text/"):
|
||||
kwargs["details"] = response.text
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user