Reference
Error handling
Errors are DecaneError, a LocalizedError with one case per class. code is identical to the JS SDKs’ error.code, and retryable says whether trying again could succeed.
swift
do {
try await wallet.verifyEmailCode(email: email, code: code)
} catch let error as DecaneError {
if error.retryable { showRetry(error.localizedDescription) }
log(error.code) // "NETWORK", "RECONNECT_REQUIRED", …
}| Case | Code | Meaning |
|---|---|---|
.network | NETWORK | The request never completed |
.reconnectRequired | RECONNECT_REQUIRED | Sign in again |
.sessionExpired | SESSION_EXPIRED | The session ended |
.invalidApiKey | INVALID_API_KEY | Key invalid or revoked |
.walletEnrolmentFailed(cause:) | WALLET_ENROLMENT_FAILED | Creation stopped; nothing was left behind, try again |
.walletExists | WALLET_EXISTS | The account already has a wallet; it is opened instead |
.provisioningRateLimited | PROVISIONING_RATE_LIMITED | Too many new-device setups this hour |
.provisioningTimeout(step:) | PROVISIONING_TIMEOUT | Wallet setup took too long |
.attestationFailed(message:) | ATTESTATION_FAILED | The enclave could not be verified |
.enclaveHTTP(status:message:) | ENCLAVE_HTTP | Any other enclave error |
.callSequence(message:) | CALL_SEQUENCE | A call made in the wrong state, or not in this version |
.platformHookMissing(hook:purpose:) | NATIVE_MODULE_MISSING | A feature needs a hook that is not installed |
.userCancelled | USER_CANCELLED | The user dismissed a prompt |
The rest (device tier, passkeys and recovery) mirror the JS SDKs: unlockRequired, webAuthnUnsupported, invalidPin, shareCorrupted, newDevice, staleDeviceShare, recoveryFailed, invalidRecoveryFile, wrongPassword, recoveryWalletMismatch, exportNotAuthorized, unlockTokenRejected, biometricUnavailable, originNotAllowed.