Fix: Skip missing products in menu categorization instead of raising exception#127
Open
dmcgill50 wants to merge 1 commit intoggrammar:masterfrom
Open
Fix: Skip missing products in menu categorization instead of raising exception#127dmcgill50 wants to merge 1 commit intoggrammar:masterfrom
dmcgill50 wants to merge 1 commit intoggrammar:masterfrom
Conversation
…exception The Domino's API sometimes references product codes in the Categorization section that don't exist in Products, Coupons, or PreconfiguredProducts. This causes Menu object creation to fail with "PRODUCT NOT FOUND" errors. Root Cause: - Categorization lists products by code (e.g., "9413") - These codes don't always exist in the parsed menu items - They may be phantom references, excluded items, or unsupported products Solution: Changed line 66 in build_categories() from raising an exception to gracefully skipping missing products with 'continue'. This allows the menu to load successfully while only including valid, available products. Impact: - Fixes issues ggrammar#115, ggrammar#125, ggrammar#119, and other "PRODUCT NOT FOUND" errors - Enables Menu and Order objects to be created successfully - Maintains backward compatibility - No breaking changes to the API Tested: - Successfully creates Menu objects that previously failed - Order creation works with the patched library - Items can be added to orders and placed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.