ktdreyer / errata-tool-ansible

Ansible modules to manage Red Hat Errata Tool resources
GNU General Public License v3.0
4 stars 14 forks source link

handle non-JSON responses in ErrataToolError #296

Closed ktdreyer closed 1 year ago

ktdreyer commented 1 year ago

In https://github.com/ktdreyer/errata-tool-ansible/issues/295 , we encountered an errata-rails server that returned non-JSON for an expected endpoint.

ErrataToolError always expects to call response.json(), so we should wrap that and catch requests.exceptions.JSONDecodeError for cases when the server returns non-JSON (eg. HTML).