ReadonlycodeThe Agents API's own classification of the failure — the kind from D-ID's
{ kind, description } error body — and 'HttpError' when the response was not that
envelope.
An account out of credits comes back as 'InsufficientCreditsError', for instance. It is a
plain string because the set is the API's, not the SDK's, and grows without an SDK release.
Use status for the transport-level branch, this for the API-level
one, and kind to tell an HttpError from the SDK's other errors.
Optional ReadonlyendpointPath of the request that failed, relative to the API client's base path — for example
/agt_x/chat/cht_y for a message sent to a chat.
Absent when the error was constructed without call context. NetworkError.endpoint is the same value on a transport failure.
ReadonlykindAlways 'HttpError'. Branch on it to tell this failure from the other SDK errors.
Optional ReadonlymethodHTTP method of the request that failed, such as GET or POST.
Absent when the error was constructed without call context.
Optional ReadonlyoriginalThe 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.
ReadonlystatusHTTP status code of the response, such as 401, 404 or 500.
Serializes the error, adding the failing call to what BaseError.toJson() already returns.
Adds code, httpStatus from status, and
endpoint and method when the call context is known. The raw status property is
serialized as httpStatus.
The error as plain, JSON-serializable data.
A request to the Agents API came back with a non-2xx status.
Raised for every REST call the SDK makes on the application's behalf: fetching the agent in createAgentManager, creating the stream and the chat during connect(), sending a message with chat(), and the rating and feedback calls. The same error is both handed to onError and thrown, so it also rejects the promise of whichever method made the request — catch it around that call, or handle it centrally in the callback. For the message-send request behind chat() the callback may not fire; the error is still thrown. Typical cases are
401or403for a client key that is not authorized for the agent or the calling domain, and404for an unknown agent id; an account that is out of credits comes back with code'InsufficientCreditsError'. A429is retried twice, one second apart (three attempts in total), before it surfaces.kind is always
'HttpError', so aswitchon it narrows a caught value to this class. The server's own classification lives on code — the'InsufficientCreditsError'above is one — so a message-independent branch on a specific API failure is possible.The message is the envelope's
descriptionwhen the body is that JSON, and the raw body otherwise — truncated to 256 characters either way, because a gateway can answer a 5xx with a whole HTML page.