Exceptions
This article refers to SDK version v0.5.0. The current SDK version is N/A.
Every API error the SDK raises is a subclass of BarbaraApiError, so you can catch broadly or narrow down to a specific failure mode.
BarbaraApiError
BarbaraApiError(message: str, *, status: Optional[int] = None, body: Any = None)
Base error for any non-2xx response from the Barbara API.
body is the server's raw error response (parsed JSON if the
response was JSON, otherwise raw text) — never the request you sent,
so it can't contain your credentials. It CAN still contain data about
the resource you were operating on (e.g. a validation error echoing
back a field value). Avoid logging exc.body indiscriminately in a
context you don't control — log str(exc)/exc.status instead
unless you specifically need the body for debugging.
BarbaraAuthError
Raised when authentication (token request or refresh) fails.
BarbaraNotFoundError
Raised on a 404, or when a lookup by name (e.g. deviceName) has no match.
BarbaraPermissionError
Raised on a 401/403 for a required (non-optional) resource.
Signatures above are generated from barbara-api-sdk 0.5.0 docstrings. If a new SDK release changes one, this page needs a re-sync — the surrounding prose does not update itself.