SatelliteQE / nailgun

Why use a hammer when you can use a nailgun.
GNU General Public License v3.0
46 stars 83 forks source link

[6.15.z] Abstract adding json respone to error message #1236

Closed Satellite-QE closed 1 month ago

Satellite-QE commented 1 month ago

Cherrypick of PR: https://github.com/SatelliteQE/nailgun/pull/1224

Description of changes

The output of raise_for_status is not really descriptive for since the actual error message is not part of the exception.

This commit exapnds on 95b3ce10125cfbc8d9a6d8a8e2b38a5007dd1b16

Adds existing solution to all raise_for_status calls.

Functional demonstration

Example:

requests.exceptions.HTTPError: ('500 Server Error: Internal Server Error for url: https://robo-main-orcharhino-alma8.infra.dev.atix/katello/api/v2/repositories/42', {'displayMessage': 'Repository cannot be deleted since it has already been included in a published Content View. Please delete all Content View versions containing this repository before attempting to delete it or use --remove-from-content-view-versions flag to automatically remove the repository from all published versions.', 'errors': ['Repository cannot be deleted since it has already been included in a published Content View. Please delete all Content View versions containing this repository before attempting to delete it or use --remove-from-content-view-versions flag to automatically remove the repository from all published versions.']})

vs.

requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://robo-main-orcharhino-alma8.infra.dev.atix/katello/api/v2/repositories/24