D-ID Client SDK - v3.0.0-0
    Preparing search index...

    Class NetworkError

    A request to the Agents API never reached the server, so no response came back.

    This is the transport failure counterpart of HttpError, where the server did answer: the browser's fetch rejected outright because the device is offline, DNS or TLS failed, the connection was refused or the request was blocked, for instance by CORS or an extension. Like HttpError it is both handed to onError and thrown, so it also rejects the promise of the method that made the request; for the message-send request behind chat() the callback may not fire, but the error is still thrown. A request the SDK cancelled itself is not reported this way — the browser's own AbortError is rethrown unchanged.

    The message is always 'Network request failed'; the browser's own wording, such as 'Failed to fetch', is kept in originalError and appears as cause in toJson(). The remaining properties record what was happening at the time, which is usually what distinguishes a dropped connection from a tab that was backgrounded.

    Hierarchy (View Summary)

    Index
    durationMs?: number

    How long the request ran before it failed, in milliseconds.

    A value close to zero usually means the request never left the browser; a large one points at a connection that was established and then lost.

    endpoint?: string

    Path of the request that failed, relative to the API client's base path — for example /agt_x/chat/cht_y.

    kind: "NetworkError" = 'NetworkError'

    Always 'NetworkError'. Branch on it to tell this failure from the other SDK errors.

    method?: string

    HTTP method of the request that failed, such as GET or POST.

    online?: boolean

    The browser's navigator.onLine at the moment of the failure — false when the device reported itself offline.

    originalError?: unknown

    The error or value that caused this one, when the SDK was wrapping something else.

    For a NetworkError this is the browser's own fetch rejection. It is not serialized as-is: toJson() takes only an Error cause's message.

    visibility?: DocumentVisibilityState

    The page's document.visibilityState at the moment of the failure.

    'hidden' means the tab was in the background, where browsers throttle or suspend network activity.