BridgeError with machine-readable codes and recoverability metadata.
The BridgeError class
Error codes
Handling patterns
There are three useful ways to react to aBridgeError: 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:- Transport-level errors β the request never reaches the host or the response is lost (e.g.,
TIMEOUT) - Host-level errors β the host received the request but returned an error (e.g.,
PERMISSION_DENIED,UNSUPPORTED,CANCELLED)
BridgeError instances.