Skip to main content

Module error

Module error 

Source
Expand description

Client error types, envelope extraction, and status classifications. Error taxonomy and header parsing for the client, mirroring the TypeSafe Python SDK exception hierarchy:

RustPython SDKHTTPServer code
ApiErrorKind::BadRequestTypeSafeBadRequestError400bad_json
ApiErrorKind::AuthenticationTypeSafeAuthenticationError401unauthorized
ApiErrorKind::NotFoundTypeSafeNotFoundError404unknown_model
ApiErrorKind::PayloadTooLarge—413payload_too_large
ApiErrorKind::UnprocessableEntityTypeSafeUnprocessableEntityError422invalid_body
ApiErrorKind::RateLimitTypeSafeRateLimitError429rate_limited
ApiErrorKind::OverloadedTypeSafeAPIOverloadedError529overloaded
ApiErrorKind::InternalServerTypeSafeInternalServerError5xxbackend_error / internal_error

429/529 responses carry retry-after-ms (milliseconds, preferred) and Retry-After (seconds, or an HTTP-date) headers; both are parsed into ApiError::retry_after so crate::RetryPolicy can back off exactly as long as the server asks.

Structs§

ApiError
A single unsuccessful HTTP response, with everything a caller needs to react: status, parsed error envelope, request id for support tickets, and the retry delay the server asked for.

Enums§

ApiErrorKind
Coarse classification of an ApiError by status, mirroring the Python SDK exception subclasses.
Error
All client failures. Error::Api wraps the unsuccessful-response case; the other variants cover transport, timeout, decoding, response validation, and configuration problems.

Functions§

parse_retry_after
Parse the retry delay the server asked for, in order of preference: