Skip to main content

Error Handling

This guide covers error handling patterns for the Privacy Boost iOS SDK. For the cross-platform error code reference, see Error Handling.

SDKError

All SDK errors are thrown as SDKError enum cases:

Type-Safe Error Handling

Use Swift’s pattern matching to handle specific error cases:

Retry with Exponential Backoff

For retryable errors, use exponential backoff:

Auto Re-Authentication

Handle expired sessions by re-authenticating automatically:

User-Friendly Error Messages

Map SDK errors to messages suitable for showing to users:

Categorizing Errors

Group errors by whether user action can resolve them:

SwiftUI Error Handling Pattern

Best Practices

1. Always Handle signatureRejected Silently

When a user cancels a wallet signature, don’t show an error — just return to the previous state:

2. Log Errors for Debugging

3. Use Error Categories for UI Decisions

Next Steps