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.
| Code | Thrown by | Recovery guidance |
|---|---|---|
CONFIGURATION_MISSING | Any call before init succeeds | Await waitForInitialization() or retry later. |
FAILED_TO_GET_CURRENT_PERSON | getCurrentPerson() | Serve cached state; see Check access. |
FAILED_TO_SET_PERSON_ATTRIBUTES | setPersonAttributes() | Retry later. |
FAILED_TO_IDENTIFY | identify() | Retry; an already-identified person surfaces this code too. |
FAILED_TO_GET_FEATURE_FLAGS | getFeatureFlags() | Fall back to defaults. |
FAILED_TO_GET_PRODUCTS | getProducts() | Retry or render without store metadata. |
FAILED_TO_PURCHASE | purchase(product:) | Reserved for the later commerce launch. |
FAILED_TO_RESTORE_PURCHASES | restorePurchases() | Prompt the customer to retry. |
Purchase availability
purchase(product:) currently throws before StoreKit is touched:
| Code | Meaning |
|---|---|
READ_ONLY_PURCHASE_NOT_ALLOWED | Purchase initiation is unavailable in the observer-only release. |