Skip to content
This repository was archived by the owner on Jul 11, 2025. It is now read-only.

Improve checkout process with error handling and inventory management #33

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

Conversation

seer-by-sentry[bot]
Copy link

@seer-by-sentry seer-by-sentry bot commented Jul 8, 2025

Fixes REACT-5FV. The issue was that: Backend inventory check failed for product ID 4 (Botana Voice) as requested quantity (3) exceeded available stock (2), causing an unhandled exception and 500 error.

  • Added InsufficientInventoryError exception for better error handling.
  • Updated process_order to handle cart items and quantities separately.
  • Implemented error handling in the /checkout route for insufficient inventory, bad requests, and unexpected errors.
  • Return JSON responses with error codes and messages for checkout failures.
  • Increased initial inventory for products.

This fix was generated by Seer in Sentry, triggered automatically. 👁️ Run ID: 61612

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

Comment on lines +98 to +102
return jsonify({
"error": "InsufficientInventory",
"message": str(e),
"product_id": e.product_id
}), 409 # Use 409 Conflict

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.
"product_id": e.product_id
}), 409 # Use 409 Conflict
except ValueError as e:
return jsonify({"error": "BadRequest", "message": str(e)}), 400 # Use 400 Bad Request

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants