Skip to main content

Interface: SessionError

Defined in: packages/media-session/src/types.ts:241

Something the session could not do, delivered to MediaHandler.onSessionError.

The failures on this channel have no caller to reject to — they happen on a media3 service callback, an MPRemoteCommandCenter target, or an artwork download that finished long after the broadcast that asked for it. A call the app makes still throws MediaSessionError synchronously; this is the other half, and before it existed every member of it was a log line and nothing more (CLAUDE.md principle 6).

class Handler extends BaseMediaHandler {
override onSessionError(error: SessionError): void {
if (error.severity === 'fatal') showBanner(error.message)
else console.warn(`[${error.code}] ${error.message}`)
}
}

Properties

code

readonly code: SessionErrorCode;

Defined in: packages/media-session/src/types.ts:243

Which failure. See SessionErrorCode for the per-platform rules.


message

readonly message: string;

Defined in: packages/media-session/src/types.ts:250

A complete sentence, written for the developer who has to fix it — what failed, and where there is one, the fix. Not a bare exception string.


severity

readonly severity: SessionErrorSeverity;

Defined in: packages/media-session/src/types.ts:245

Derived from code. See SessionErrorSeverity.