Skip to main content

Error Handling

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

SDKError

All SDK errors are thrown as SDKError sealed class instances:

Type-Safe Error Handling

Use Kotlin’s when expression for exhaustive error matching:

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:

ViewModel Error Handling Pattern

Best Practices

1. Always Handle SignatureRejected Silently

When a user cancels a wallet signature, don’t show an error:

2. Log Errors for Debugging

3. Use Error Categories for UI Decisions

Next Steps