Ansible async errors + printing formatter issues (#170)

<!-- This change is generated by MagicModules. -->
/cc @rambleraptor
This commit is contained in:
The Magician 2019-01-16 15:34:34 -08:00 committed by Alex Stephen
parent 4b1523e833
commit 2ebb8245b5
6 changed files with 14 additions and 13 deletions

View file

@ -422,8 +422,8 @@ def return_if_object(module, response, kind, allow_not_found=False):
try:
module.raise_for_status(response)
result = response.json()
except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst:
module.fail_json(msg="Invalid JSON response with error: %s" % inst)
except getattr(json.decoder, 'JSONDecodeError', ValueError):
module.fail_json(msg="Invalid JSON response with error: %s" % response.text)
if navigate_hash(result, ['error', 'errors']):
module.fail_json(msg=navigate_hash(result, ['error', 'errors']))