cloudflare_dns: fix KeyError (#243)
Fix errors of the type KeyError: 'success' to show a more meaningful message Fixes: #236pull/257/head
parent
8a45044ea7
commit
055c18c892
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- cloudflare_dns - fix KeyError 'success' (https://github.com/ansible-collections/community.general/issues/236).
|
|
@ -496,6 +496,10 @@ class CloudflareAPI(object):
|
|||
if result is None:
|
||||
self.module.fail_json(msg=error_msg)
|
||||
|
||||
if 'success' not in result:
|
||||
error_msg += "; Unexpected error details: {0}".format(result.get('error'))
|
||||
self.module.fail_json(msg=error_msg)
|
||||
|
||||
if not result['success']:
|
||||
error_msg += "; Error details: "
|
||||
for error in result['errors']:
|
||||
|
|
Loading…
Reference in New Issue