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

feat: apply unified error + init coalescing#6

Merged
hyochan merged 7 commits intomainfrom
feat/renewalstate-error-messages-mdlint
Sep 9, 2025
Merged

feat: apply unified error + init coalescing#6
hyochan merged 7 commits intomainfrom
feat/renewalstate-error-messages-mdlint

Conversation

@hyochan
Copy link
Member

@hyochan hyochan commented Sep 9, 2025

Overview

  • Unifies error handling and simplifies initialization.

Error Handling

  • Consolidates error event payload into OpenIapError
    • Provides default messages
    • Uses a single E_* code source
    • Adds errorCodes / errorMessages for bridging

Enum Changes

  • Rename thrown enum to OpenIapFailure
  • Update all listeners and examples accordingly

- Use StoreKit RenewalState for subscription status and encode as string for JSON compatibility.
- Add default messages for all error codes and expose errorMessages() for bridging.
- Fill missing error code mappings and disable markdownlint MD013/MD033.
Replace PurchaseError struct with OpenIapErrorEvent under OpenIapError namespace and re-export via typealiases for backward compatibility. Move constants and default messages to OpenIapError namespace to avoid duplication.
Remove legacy PurchaseError and OpenIapPurchaseError; integrate error event into OpenIapError as OpenIapErrorEvent. Update all references, listeners, and examples to use the unified type and OpenIapError E_* constants. Remove backward-compat typealiases as requested.
Add initTask to OpenIapModule to deduplicate concurrent initConnection calls and have ensureConnection() auto-initialize when needed. Cancel in-flight init on endConnection to prevent races.
…wn enum

Unify event payload as OpenIapError with defaultMessage() factory and move all E_* codes + errorCodes() under it. Rename thrown enum to OpenIapFailure and update all throw sites. Replace hardcoded event messages with defaultMessage-based factories.
Deduplicate initialization logic by inlining the coalescing behavior into initConnection() and calling it from ensureConnection(). This reduces indirection and keeps init guarding in one place.
Resolve merge conflicts by keeping unified error (OpenIapError + OpenIapFailure), updated init coalescing, and example/type changes. Also retain markdownlint config additions.
@hyochan hyochan merged commit 81bc2d8 into main Sep 9, 2025
1 check passed
@hyochan hyochan deleted the feat/renewalstate-error-messages-mdlint branch September 9, 2025 17:01
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.

1 participant