Skip to content

Exceptions reference

Every SDK operational failure derives from ECNClientError. Exceptions expose a stable code, optional operation label, and redacted details. Messages deliberately omit raw transport errors, credentials, and payload inputs.

ExceptionMeaning
ConfigurationErrorConfiguration could not be used at runtime.
AuthenticationErrorMQTT authentication failed.
AuthorizationErrorA broker ACL or operation-specific negative acknowledgment, including SUBACK, PUBACK, or UNSUBACK, denied the exact operation.
ConnectionErrorDNS, TCP, TLS, MQTT, or reconnect failure.
DeliveryErrorA mutation failed at a delivery boundary. The error carries the strongest safe delivery phase and, when applicable, a task or operation identifier; it does not imply that retry is safe.
OutcomeUnknownErrorA mutation may have reached the broker or downstream handler, but completion is unknown. The client does not replay it automatically.
TransportBoundaryErrorA reviewed-container-network endpoint resolved outside its required private-address boundary.
ProtocolErrorReceived MQTT or payload violates the supported wire.
ValidationErrorCaller input violates an SDK model or operation contract.
TimeoutErrorA bounded operation exceeded its deadline.
NotReadyErrorAn operation requires a ready, open client.
ResourceLimitErrorA payload, buffer, task, or outstanding-work bound was reached.
ClockErrorThe configured ECN clock endpoint could not be measured.
ClockProtocolErrorAn NTP response or local timing measurement was malformed, mismatched, unsynchronized, or otherwise unusable.
ClockToleranceErrorA valid report’s absolute offset plus conservative local timing uncertainty exceeded the caller’s tolerance; the report remains available on the exception.

Catch narrowly when recovery differs, or catch the base type at an application boundary:

from picogrid_ecn_client import ECNClient, ECNClientError
async def run(client: ECNClient) -> None:
try:
await client.start()
except ECNClientError as exc:
print(exc.code, exc.operation)

Do not log authentication objects or add secret values to a replacement exception. Use troubleshooting with the runnable preflight example.

Version 0.2.0 · branch main