Skip to main content
Everything the SDK throws is an SDKException, wrapping a proto-backed error so the same code and category cross every language binding.
isSDKException is the type guard to use. A bare instanceof can fail across bundle boundaries when two copies of the package end up in one page.

Codes worth handling

unsupportedCapability

Two cases you will actually meet:

Browser-specific failures

Some failures are the browser, not the SDK, and reading them as SDK errors sends you the wrong way:

Errors in streams

Preflight throws from the call. A failure during generation arrives as a failed event rather than an exception:
This is the opposite of React Native, where in-flight failures are thrown into the consumer. Do not share one error-handling helper between the two without checking.

Cancellation

Breaking out of the loop cancels the request and is not an error.

Reporting

Rethrow what you did not recognise. Swallowing every error in a catch is how a broken build looks like a working one.