mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cloudscale: improve error handling (#53054)
This commit is contained in:
parent
76e0e0080b
commit
ca91ac2ca0
1 changed files with 2 additions and 2 deletions
|
@ -34,7 +34,7 @@ class AnsibleCloudscaleBase(object):
|
||||||
timeout=self._module.params['api_timeout'])
|
timeout=self._module.params['api_timeout'])
|
||||||
|
|
||||||
if info['status'] == 200:
|
if info['status'] == 200:
|
||||||
return self._module.from_json(to_text(resp.read()))
|
return self._module.from_json(to_text(resp.read(), errors='surrogate_or_strict'))
|
||||||
elif info['status'] == 404:
|
elif info['status'] == 404:
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
|
@ -55,7 +55,7 @@ class AnsibleCloudscaleBase(object):
|
||||||
timeout=self._module.params['api_timeout'])
|
timeout=self._module.params['api_timeout'])
|
||||||
|
|
||||||
if info['status'] in (200, 201):
|
if info['status'] in (200, 201):
|
||||||
return self._module.from_json(to_text(resp.read()))
|
return self._module.from_json(to_text(resp.read(), errors='surrogate_or_strict'))
|
||||||
elif info['status'] == 204:
|
elif info['status'] == 204:
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue