Error Handling
The Privacy Boost SDK uses structured error codes so you can handle errors programmatically. Every error has a stablecode 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
Useerror.retryable with exponential backoff:
Re-authenticate on session expiry
Map errors to user-friendly messages
Best Practices
-
Match on
error.code, noterror.message. Codes are stable across versions; messages may change. - Never show raw error messages to users. Map codes to context-appropriate messages.
-
Handle
TRANSACTION_REJECTEDsilently. The user intentionally cancelled. -
Use
error.retryablefor retry logic. The SDK marks transient errors as retryable. -
Log the full error internally. Capture
code,message, andcausefor 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