Skip to main content

Error Handling & Performance

This guide covers TypeScript-specific error handling patterns and performance optimization. For the cross-platform error code reference, see Error Handling.

PrivacyBoostError

All SDK errors extend PrivacyBoostError:

Type-Safe Error Handling

Retry with Exponential Backoff

Auto Re-Authentication

User-Friendly Error Messages

WASM Loading

The SDK includes a WebAssembly module for ZK proof generation. Managing how and when it loads affects initial page load time.

Lazy Loading

Don’t import the SDK at the top level in routes that don’t need it:

Preloading

For routes that will need the SDK, preload in the background:

Code Splitting

Tree Shaking

Import only what you need:

Caching & Network

Balance Caching

The SDK caches balances locally. Control refresh behavior:

Request Deduplication

Avoid redundant concurrent requests:

Parallel Requests

Next Steps