fix(apple): map StoreKitError.userCancelled to correct err code#40
Conversation
Map StoreKitError to PurchaseError in wrap() method to ensure user cancellation returns 'user-cancelled' instead of 'purchase-error'. Fixes hyochan/expo-iap#261
WalkthroughThe PR adds StoreKit error mapping to the Changes
Sequence DiagramsequenceDiagram
participant User
participant Module as OpenIapModule
participant StoreKit
participant ErrorWrapper as PurchaseError.wrap()
participant Handler as Error Handler
User->>Module: requestPurchase()
Module->>StoreKit: initiate purchase
StoreKit-->>Module: StoreKitError.userCancelled
rect rgba(255, 182, 193, 0.3)
Note over Module,ErrorWrapper: NEW: Error Mapping
Module->>ErrorWrapper: wrap(StoreKitError.userCancelled, fallback: .purchaseError)
ErrorWrapper-->>Module: PurchaseError.userCancelled
end
Module->>Handler: emit mapped error
Handler->>User: throw PurchaseError.userCancelled
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related issues
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (2)packages/apple/Sources/**/*.swift📄 CodeRabbit inference engine (CLAUDE.md)
Files:
packages/apple/Sources/Models/**/*.swift📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (3)📚 Learning: 2025-10-18T05:54:54.802ZApplied to files:
📚 Learning: 2025-10-18T05:54:54.802ZApplied to files:
📚 Learning: 2025-10-18T05:54:54.802ZApplied to files:
🧬 Code graph analysis (1)packages/apple/Sources/OpenIapModule.swift (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Map StoreKitError to PurchaseError in wrap() method to ensure user cancellation returns 'user-cancelled' instead of 'purchase-error'.
Fixes hyochan/expo-iap#261
Summary by CodeRabbit