cloudscale: improve error handling (#53054)

This commit is contained in:
René Moser 2019-02-27 10:22:20 +01:00 committed by GitHub
parent 76e0e0080b
commit ca91ac2ca0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,7 +34,7 @@ class AnsibleCloudscaleBase(object):
timeout=self._module.params['api_timeout'])
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:
return None
else:
@ -55,7 +55,7 @@ class AnsibleCloudscaleBase(object):
timeout=self._module.params['api_timeout'])
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:
return None
else: