Skip to main content
All bridge errors are typed as BridgeError with machine-readable codes and recoverability metadata.

The BridgeError class

Error codes

Handling patterns

There are three useful ways to react to a BridgeError: branch on the specific code, branch on the recoverable flag, or sidestep the error entirely by checking capabilities upfront. Pick whichever fits the call site β€” they compose naturally.

Switch on error code

Check recoverability

Capability check before request

Avoid errors entirely by checking capabilities first:

Discovery errors

discoverCapabilities() can fail if the host doesn’t respond. The React <BridgeProvider> handles this gracefully β€” capabilitiesReady is still set to true, capabilities remain empty, and the app continues normally. If using the core library directly:

Request errors vs. response errors

There are two distinct error paths:
  1. Transport-level errors β€” the request never reaches the host or the response is lost (e.g., TIMEOUT)
  2. Host-level errors β€” the host received the request but returned an error (e.g., PERMISSION_DENIED, UNSUPPORTED, CANCELLED)
Both are surfaced as BridgeError instances.

Logging and debugging