Error Handling
This guide covers error handling patterns for the Privacy Boost React Native SDK. For the cross-platform error code reference, see Error Handling Concepts.SdkError
All SDK errors are instances ofSdkError, a tagged union where each variant
is a constructable class exported under SdkError.*. Use .instanceOf(err)
to check the variant, or inspect err.tag (values come from the
SdkError_Tags enum).
Basic Error Handling
PreferinstanceOf over manual tag checks — it’s safer against variant
renames:
Accessing variant data: errors expose their payload under.inner(e.g.error.inner.message,error.inner.retryAfterMs). The cast toanyis needed because the generated union widens the type.
Switch on error.tag
If you prefer a single switch block over cascading ifs: