Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstract adding json respone to error message #1224

Merged

Conversation

dosas
Copy link
Collaborator

@dosas dosas commented Sep 2, 2024

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 95b3ce1

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

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 95b3ce1

Adds existing solution to all raise_for_status calls.
@dosas dosas added CherryPick PR needs CherryPick to previous branches 6.14.z 6.15.z 6.16.z labels Sep 2, 2024
@omkarkhatavkar
Copy link

Can one of the admins verify this patch?

Copy link
Member

@ogajduse ogajduse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JacobCallahan, since you reviewed #1119 already, would you mind reviewing this one too?

Copy link
Member

@JacobCallahan JacobCallahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK on the proposed changes. However, @dosas can you check what the downstream effects on robottelo may be? Specifically if there are assertions on the contents of the exceptions raised here?

@dosas
Copy link
Collaborator Author

dosas commented Oct 7, 2024

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.

@dosas dosas requested a review from JacobCallahan October 10, 2024 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.14.z 6.15.z 6.16.z CherryPick PR needs CherryPick to previous branches
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants