Skip to main content

SDK Exceptions

Both SDKs raise one class per failure mode, each carrying status_code / statusCode, endpoint, and payload.

PythonTypeScriptRaised on
AISDKErrorCustodianErrorbase class
AuthenticationErrorAuthenticationError401 — key missing / invalid / expired
NotFoundErrorNotFoundError404 — agent / app / squad not found
ValidationErrorValidationError422 — bad request body
ServerErrorServerError5xx, after retries
APIConnectionErrorAPIConnectionErrornetwork failure / timeout
APIResponseErrorAPIResponseErrorany other 4xx
from custodian_labs import AISDKError
try:
...
except AISDKError as e:
print(e.status_code, e.endpoint)
import { CustodianError } from "@custodianlabs/sdk";
try {
// ...
} catch (e) {
if (e instanceof CustodianError) console.log(e.statusCode, e.endpoint);
}

See also​

Error Handling (Python) · (TypeScript)