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

Properly parse errorMessage key in error response #1526

Merged
merged 2 commits into from Nov 19, 2022
Merged

Properly parse errorMessage key in error response #1526

merged 2 commits into from Nov 19, 2022

Conversation

GeyseR
Copy link
Contributor

@GeyseR GeyseR commented Nov 3, 2022

After recent refactoring of the resilientsession module, we started to get empty text field in the JIRAError instances for the "Site temporary unavailable" errors.

This PR adds proper processing of such error responses and also adds consistency in errors processing in several parts of the lib

Copy link
Collaborator

@adehad adehad left a comment

Choose a reason for hiding this comment

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

thanks for catching this.

Could you add some tests for this? The tests/test_resilientsession.py would be the best place

Comment on lines 332 to 333
raise_on_error(r)
error_list = parse_errors(r)
logging.error(error_list)
Copy link
Collaborator

Choose a reason for hiding this comment

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

would we want to log the error and afterwards raise?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it looks like raising the error should be removed completely as it will always raise for 400 HTTP response
previously it was raised in the json_loads and caught by get_error_list code

@GeyseR
Copy link
Contributor Author

GeyseR commented Nov 18, 2022

I've fixed the issue with unexpected error raising and added a test for errors parsing logic

Copy link
Collaborator

@adehad adehad left a comment

Choose a reason for hiding this comment

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

Excellent stuff

@adehad adehad merged commit f9b84a1 into pycontribs:main Nov 19, 2022
@adehad
Copy link
Collaborator

adehad commented Nov 19, 2022

Thanks for the great quality PR !

@GeyseR GeyseR deleted the errors-processing branch November 19, 2022 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants