Errors

Structured error codes and recovery guidance for the Swift SDK.

Swift SDK methods throw on failure. Errors surface as typed errors whose string form is "CODE: message". Match on code when recovery differs, and report the full error for everything else:

do {
    let products = try await voidhash.getProducts()
} catch let error as VoidhashStoreError where error.code == "FAILED_TO_GET_PRODUCTS" {
    // retry, fall back to cached products, …
}

Operation codes

These codes name the client operation that failed. The message text is informational — never match on it.

CodeThrown byRecovery guidance
CONFIGURATION_MISSINGAny call before init succeedsAwait waitForInitialization() or retry later.
FAILED_TO_GET_CURRENT_PERSONgetCurrentPerson()Serve cached state; see Check access.
FAILED_TO_SET_PERSON_ATTRIBUTESsetPersonAttributes()Retry later.
FAILED_TO_IDENTIFYidentify()Retry; an already-identified person surfaces this code too.
FAILED_TO_GET_FEATURE_FLAGSgetFeatureFlags()Fall back to defaults.
FAILED_TO_GET_PRODUCTSgetProducts()Retry or render without store metadata.
FAILED_TO_PURCHASEpurchase(product:)Reserved for the later commerce launch.
FAILED_TO_RESTORE_PURCHASESrestorePurchases()Prompt the customer to retry.

Purchase availability

purchase(product:) currently throws before StoreKit is touched:

CodeMeaning
READ_ONLY_PURCHASE_NOT_ALLOWEDPurchase initiation is unavailable in the observer-only release.

Next steps