Fix failing to parse json error msg

It assumes its a requests response but could
be a HTTPResponse from urllib.

Story: 2008789
Task: 42183

Change-Id: I7306d167a17284c7f478ec1c1599a8d4b32040c2
This commit is contained in:
Tobias Urdin 2020-11-18 11:46:44 +01:00 committed by Bharat Kunwar
parent d549651f6d
commit f7551a6bac

View File

@ -69,6 +69,9 @@ def _extract_error_json(body, resp):
try:
body_json = resp.json()
return _extract_error_json_text(body_json)
except AttributeError:
body_json = jsonutils.loads(body)
return _extract_error_json_text(body_json)
except ValueError:
return {}
else: