Skip to main content

Type Alias: SessionErrorSeverity

type SessionErrorSeverity = "fatal" | "degraded";

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

How much a SessionError took away.

Two members, and the split is operational rather than editorial — an app reacts differently to each, which is the only reason a severity exists at all:

  • 'fatal'background playback is not going to work. Either the OS refused to protect the process (so the audio the user started is running unprotected, with no notification on Android), or a resumption the user asked for did not happen. Worth surfacing to the user, or worth stopping for; it is not going to fix itself.
  • 'degraded' — the session is alive and playing; some surface is showing less than the app asked for (no cover, a fallback icon, a missing scrubber), or an opt-in is quietly inert. Worth a log and a bug, not an alert.

It is a pure function of SessionError.code and it is still carried on every event, deliberately: an app that branches on severity keeps behaving correctly when this closed union grows a member, where an app that branches on code alone would drop the new one into its default arm.