Python SDK / Errors
Errors
Every error the SDK raises derives from ZeliError, so you can catch
the base type broadly or a specific subclass narrowly.
from zeli import (
ZeliError,
ConfigurationError,
AuthenticationError,
ConnectionError,
SessionError,
TimeoutError,
VoiceTurnError,
VoiceSocketError,
)ZeliError
Base class for all SDK errors.
| Attribute | Type | Description |
|---|---|---|
message | str | Human-readable description. |
code | str | None | Stable, machine-readable code (e.g. "unauthorized", "timeout"). |
str(error) renders as [code] message when a code is present.
Subclasses
| Exception | Raised when |
|---|---|
ConfigurationError | The client or avatar configuration is invalid or incomplete (e.g. both avatar_id and avatar_config, or an empty server_url). |
AuthenticationError | The API key / session token was rejected by the server. |
ConnectionError | The transport (HTTP signalling or WebRTC) failed to establish or dropped. |
SessionError | The server refused to start a session, or an operation failed (e.g. talk() without the control gateway). |
TimeoutError | An operation did not complete within its allotted time. |
VoiceTurnError | One turn on the microphone socket failed, on a socket that is still good. |
VoiceSocketError | The microphone socket is in trouble, rather than one turn on it. |
A VoiceTurnError means this turn could not be answered and the
socket is still listening, so the next one can still work. A
VoiceSocketError is the socket: when fatal is true a
close follows immediately, and close_code carries the server's own
reason, which says whether the session was retired rather than the microphone
refused, and whether dialling again is worth anything. Both arrive as
ZeliEvent.ERROR; the type is what separates them.
Catch ZeliError to handle anything the SDK throws, or a specific
subclass to react to a particular failure. See the
error-handling guide for patterns.