Errors
Structured error codes and recovery guidance for the Kotlin SDK.
When an SDK call fails, it throws a VoidhashException. Every exception carries a stable,
machine-matchable code string. The code tells you which operation failed and what to do next.
Match on error.code when the recovery differs by cause, and report the full error for everything
else.
This example handles one specific code and lets every other error propagate:
try {
val products = voidhash.getProducts()
} catch (error: VoidhashException) {
if (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 | Retry after initialize() succeeds. |
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 your default values. |
FAILED_TO_GET_PRODUCTS | getProducts() | Retry, or render the screen without store metadata. |
FAILED_TO_PURCHASE | purchase(...) | Reserved for the later commerce launch. |
FAILED_TO_RESTORE_PURCHASES | restorePurchases() | Prompt the customer to retry. |
INVALID_TRANSACTION | reportTransaction(...) | Supply a non-empty Google Play purchase token. Multi-product purchases are unsupported. |
BILLING_CONNECTION_FAILED | syncPurchases(), restorePurchases() | The Play Billing connection did not open. A later sync call retries it. |
FAILED_TO_FLUSH_ANALYTICS | flush() | Nothing to do. Events stay queued and flush later. |
Client-state codes
These codes describe the state of the client rather than a single operation:
| Code | Meaning |
|---|---|
READ_ONLY_PURCHASE_NOT_ALLOWED | Purchase initiation is unavailable in the observer-only release. |
UNSUPPORTED_PLATFORM | A platform-specific method ran on a platform it does not support. |
UNKNOWN | An unexpected failure. Report the full error. |