Skip to main content

Function: receiverFetchError()

function receiverFetchError(detail?: {
reason?: string;
statusCode?: number;
}): CastError;

Defined in: packages/cast/src/errors.ts:164

Build the one cast-receiver-fetch error, optionally enriched with the receiver's own detail.

The detail is Android-only, by platform ceiling. Android's RemoteMediaClient.Callback.onMediaError(MediaError) hands over getDetailedErrorCode() / getReason() (play-services-cast 22.3.1, verified with javap). iOS has no equivalent: GCKRemoteMediaClientListener (GoogleCast 4.8.6, GCKRemoteMediaClient.h) declares ten optional callbacks and none of them is a media-error callback, and GCKMediaStatus (GCKMediaStatus.h) carries no error code or reason field. On iOS the failure is synthesized natively from playerState == .idle && idleReason == .error, so code/message are identical to Android's and statusCode/reason are simply absent.

Never branch on statusCode being present — branch on code.

Parameters

ParameterTypeDescription
detail?{ reason?: string; statusCode?: number; }-
detail.reason?stringReceiver-supplied reason string (Android only).
detail.statusCode?numberReceiver-supplied detailed error code (Android only).

Returns

CastError