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

optimize error handling #19927

Closed

Conversation

cloudmagic80
Copy link
Contributor

@cloudmagic80 cloudmagic80 commented Dec 17, 2024

Summary

This PR improves flexibility and maintainability by using a list to manage error conditions, making it easier to add or modify error messages in the future. Additionally, it handles a broader range of error messages and provides a clearer return message when no retries are needed.

Comparison:
Error Conditions:

Old Code: Checks for specific error messages directly within the if statement.
New Code: Uses a list (error_conditions) to store multiple error messages and checks if any of these conditions are met.
Flexibility:

Old Code: Hardcoded error messages make it less flexible and harder to maintain.
New Code: More flexible and maintainable by using a list to manage error conditions.
Error Messages:

Old Code: Handles fewer specific error messages.
New Code: Handles a broader range of error messages by including more conditions in the list.
Return Message:

Old Code: Returns ['Error handling file uploads'] when no retries are needed.
New Code: Returns ['no retries needed'] when no retries are needed.

Related issue(s)

https://github.com/department-of-veterans-affairs/vets-api/pull/19739/files

https://github.com/orgs/department-of-veterans-affairs/projects/1533/views/1?sliceBy%5Bvalue%5D=Sprint+6&pane=issue&itemId=91234356&issue=department-of-veterans-affairs%7Cvets-api%7C19926

Testing done

E2E testing on 1010D and 7959F1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants