Fix: Skip missing products in menu categorization instead of raising exception #127
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The library currently crashes when calling
store.get_menu()with this error:This affects many users as evidenced by issues #115, #125, #119, and others.
Root Cause
The Domino's API sometimes references product codes in the
Categorizationsection that don't exist in theProducts,Coupons, orPreconfiguredProductsdictionaries. These are phantom references to items that may be:Solution
Changed
pizzapi/menu.pyline 66 to gracefully skip missing products instead of raising an exception:Testing
Tested with multiple Domino's stores that previously failed:
✅ Menu objects now create successfully
✅ Order objects can be instantiated
✅ Items can be added to orders
✅ The library is functional end-to-end
Example test:
Impact
Why This Approach
This is the safest fix because:
Alternative approaches would require:
Related Issues
Closes #115
Closes #125
Closes #119
May also fix #122, #69, and #59 which report similar menu loading issues.