Skip to main content
The SDK surfaces two kinds of failure: API errors, which are promise rejections from network calls, and SDK errors, which are thrown synchronously when a method is used incorrectly.

API errors: SdkApiError

Any method that calls the API (offers.list, offers.get, member.get, member.activity, and auth.signIn after the popup completes) rejects with an SdkApiError when the response is not 2xx.
"SdkApiError"
Use this to identify the error type. The class isn’t exported, so check err.name rather than instanceof.
number
The HTTP status code.
string
The API path that failed, e.g. "/offers".
string
Formatted as "<status> <statusText> from <path>", e.g. "403 Forbidden from /offers".

Status codes

A network failure (offline, DNS, blocked by CSP) rejects with the browser’s own TypeError: Failed to fetch rather than an SdkApiError.

SDK errors

Thrown synchronously as plain Errors. These indicate a bug in the integration rather than a runtime condition, so they’re best fixed in code rather than caught.

Sign-in errors

auth.signIn() rejects with a plain Error: It can also reject with an SdkApiError if the member profile fetch after sign-in fails.

Event handler errors

Exceptions thrown inside an on() handler are caught by the SDK and logged:
They don’t propagate and don’t stop other handlers from running.