Skip to main content

Error Handling

The Privacy Boost SDK uses structured error codes so you can handle errors programmatically. Every error has a stable code string that won’t change between SDK versions.

Quick Example

Error Types by Platform

TypeScript: PrivacyBoostError

Error Codes

Wallet Errors

These occur when interacting with the user’s wallet.

Authentication Errors

These occur during login or when a session expires.

Network Errors

These are transient and usually retryable.

Operation Errors

These occur during deposits, transfers, or withdrawals.

Compliance Errors

These occur when a transaction fails compliance screening.

Crypto Errors

These indicate failures in the cryptographic layer.

Shield Errors

These occur during shield (deposit) operations.

Transfer Errors

These occur during private transfers.

Merkle Tree Errors

These occur during proof construction.

Note Errors

These occur when accessing private notes.

Internal Errors

These indicate SDK bugs or unexpected server responses.

Recovery Patterns

Handle user rejections gracefully

When a user cancels a wallet popup, don’t show an error dialog — it’s intentional.

Retry on network errors

Use error.retryable with exponential backoff:

Re-authenticate on session expiry

Map errors to user-friendly messages

Best Practices

  1. Match on error.code, not error.message. Codes are stable across versions; messages may change.
  2. Never show raw error messages to users. Map codes to context-appropriate messages.
  3. Handle TRANSACTION_REJECTED silently. The user intentionally cancelled.
  4. Use error.retryable for retry logic. The SDK marks transient errors as retryable.
  5. Log the full error internally. Capture code, message, and cause for debugging, even when showing a simple message to the user.

Next Steps

You’ve completed the Setup section. Now dive into your platform SDK:

TypeScript

Full web SDK guide

React

Hooks and components

iOS

Native Swift SDK

Android

Native Kotlin SDK

React Native

React Native SDK

CLI

Command-line tool
For deeper TypeScript error handling patterns (retry logic, WASM loading, caching), see the TypeScript Error Handling guide.