SatelliteQE / nailgun

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

Abstract adding json respone to error message #1224

Closed dosas closed 1 month ago

dosas commented 2 months ago
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
omkarkhatavkar commented 2 months ago

Can one of the admins verify this patch?

dosas commented 1 month ago

This is the only assertion I could find regarding Internal Server Error but it is related to cli job invocations.

This should not affect the robottelo tests. The tests I have seen so far only check for requests.exceptions.HTTPError and not the content of the error message. The check on specific and meaningful error messages will be enabled by this PR.