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.

CodeThrown byRecovery guidance
CONFIGURATION_MISSINGAny call before init succeedsRetry after initialize() succeeds.
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 your default values.
FAILED_TO_GET_PRODUCTSgetProducts()Retry, or render the screen without store metadata.
FAILED_TO_PURCHASEpurchase(...)Reserved for the later commerce launch.
FAILED_TO_RESTORE_PURCHASESrestorePurchases()Prompt the customer to retry.
INVALID_TRANSACTIONreportTransaction(...)Supply a non-empty Google Play purchase token. Multi-product purchases are unsupported.
BILLING_CONNECTION_FAILEDsyncPurchases(), restorePurchases()The Play Billing connection did not open. A later sync call retries it.
FAILED_TO_FLUSH_ANALYTICSflush()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:

CodeMeaning
READ_ONLY_PURCHASE_NOT_ALLOWEDPurchase initiation is unavailable in the observer-only release.
UNSUPPORTED_PLATFORMA platform-specific method ran on a platform it does not support.
UNKNOWNAn unexpected failure. Report the full error.

Next steps