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

improve exception handling #105

Merged
merged 10 commits into from
May 18, 2023
Merged

Conversation

somethingmorerelevant
Copy link
Member

@somethingmorerelevant somethingmorerelevant commented May 17, 2023

Description of change

Manual QA steps

Risks

  • None

Rollback steps

  • revert this branch

Copy link
Contributor

@RushiT0122 RushiT0122 left a comment

Choose a reason for hiding this comment

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

Add message for MambuUnprocessableEntityError

Copy link
Contributor

@RushiT0122 RushiT0122 left a comment

Choose a reason for hiding this comment

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

We should add unittest to validate error messages.

raise MambuError(error)
except (ValueError, TypeError):
raise MambuError(error)
error_code = 500 if response.status_code > 500 else response.status_code
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we treating all 500+ error codes as 500? That doesn't look like a correct approach.

Copy link
Member Author

@somethingmorerelevant somethingmorerelevant May 17, 2023

Choose a reason for hiding this comment

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

Yes,

Logically we are not altering the request based on any http status code (apart from retrying any exception that we come across) this will only be helpful for generating appropriate log statements, but i don't find it necessary to add more exception classes right now, as mambu has over 10,000 error codes, https://support.mambu.com/docs/api-response-error-codes, and those are not the http standard error codes.

tests/unittests/test_client.py Outdated Show resolved Hide resolved
@somethingmorerelevant somethingmorerelevant dismissed RushiT0122’s stale review May 17, 2023 09:53

adding additional exception classes is not in the scope of this ticket, although they will be addressed in a different PR

@somethingmorerelevant somethingmorerelevant merged commit 4da6f53 into master May 18, 2023
@dsprayberry dsprayberry deleted the TDL-9977-fix-error-messages branch December 4, 2023 21:36
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.

3 participants