Skip to content

Implement inventory management and error handling for checkout #20

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

seer-by-sentry[bot]
Copy link

Fixes REACT-5YD. The issue was that: Backend inventory check failed due to insufficient stock, raising an unhandled exception that resulted in a 500 Internal Server Error response.

  • Added InsufficientInventoryError exception to handle cases where the requested quantity exceeds available stock.
  • Modified process_order to check for sufficient inventory before processing the order and raise InsufficientInventoryError if needed.
  • Updated the /checkout route to handle InsufficientInventoryError and return a 409 status code with details about the error.
  • Added more robust error handling to the /checkout route to catch general exceptions and return a 500 status code.
  • Modified the /checkout route to correctly parse the cart items and quantities from the request data.
  • Added copy() to the Inventory dictionary to prevent modification of the global Inventory variable.

This fix was generated by Seer in Sentry, triggered by [email protected]. 👁️ Run ID: 98037

Not quite right? Click here to continue debugging with Seer.

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.

0 participants