Skip to main content

Function: toSessionError()

function toSessionError(code: SessionErrorCode, message: string): SessionError;

Defined in: packages/media-session/src/validate.ts:711

Build the SessionError the app sees from what the bridge delivered.

The unknown-code arm is not theatre: the enum is generated for both sides from one spec, so a mismatch cannot happen within a build — but a JavaScript bundle can be swapped under a fixed binary (an OTA update), and a native code this bundle has never heard of must still reach the app. It is graded 'degraded' rather than 'fatal' because guessing loudly is worse than guessing quietly, and the message — which is written by the native side, not derived from the code — still says exactly what happened.

Parameters

ParameterType
codeSessionErrorCode
messagestring

Returns

SessionError