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

fix: Handle non-json error responses #263

Merged
merged 7 commits into from
Feb 13, 2025

Conversation

andrii-balitskyi
Copy link
Contributor

@andrii-balitskyi andrii-balitskyi commented Feb 12, 2025

@andrii-balitskyi andrii-balitskyi requested a review from a team as a code owner February 12, 2025 15:37
@razor-x
Copy link
Member

razor-x commented Feb 12, 2025

seam/client.py Outdated
@@ -76,3 +79,34 @@ def _handle_error_response(self, response: requests.Response):
raise SeamHttpInvalidInputError(error_details, status_code, request_id)

raise SeamHttpApiError(error_details, status_code, request_id)

def _is_api_error_response(self, response: requests.Response) -> bool:
Copy link
Member

Choose a reason for hiding this comment

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

If this doesn't use self it can be moved outside of the class and just be a normal internal function

Suggested change
def _is_api_error_response(self, response: requests.Response) -> bool:
def is_api_error_response(response: requests.Response) -> bool:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@razor-x what about using @staticmethod decorator instead?

Copy link
Member

Choose a reason for hiding this comment

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

Similar, but staticmethod would really be for something you wanted to expose on the class. This is really just an internal private function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andrii-balitskyi
Copy link
Contributor Author

@razor-x here's the test 0204dce

@andrii-balitskyi andrii-balitskyi self-assigned this Feb 12, 2025
@razor-x razor-x changed the title Handle non-json error responses fix: Handle non-json error responses Feb 12, 2025
@andrii-balitskyi andrii-balitskyi merged commit 71cb656 into main Feb 13, 2025
24 checks passed
@andrii-balitskyi andrii-balitskyi deleted the andrii/cx-121-handle-non-json-error-response branch February 13, 2025 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants