Skip to main content

Module error

Module error 

Source
Expand description

The provider error type, serializable error reports, and shared retry classifications for the effect protocol. Reports preserve classifications, available provider metadata, and textual source chains.

use rig_core::error::{ErrorKind, ProviderError};

let error = ProviderError::from_http_response(http::StatusCode::TOO_MANY_REQUESTS, "slow down");
assert!(error.is_retryable());
assert_eq!(error.report().kind, ErrorKind::ProviderResponse);

Structs§

EncodeError
A failure to build a provider request, returned by Wire::encode. It converts only into ProviderError::Request or ProviderError::UnsupportedOption, both of kind ErrorKind::Request, so every provider classifies its encode failures alike.
ErrorReport
A serde-able error crossing a wire boundary.

Enums§

ErrorKind
Normalized classification of an ErrorReport.
ProviderError
A failed provider operation: completion, embedding, reranking, transcription, image or audio generation, verification, model listing, or context caching.

Functions§

retryable_status
The one status → retryable table.
transient_transport
Classifies StreamEnded and backend Instance errors as retryable. Protocol, header, and content-type errors are not retryable. Errors carrying an HTTP status use retryable_status. This does not guarantee the server has not processed the request.

Type Aliases§

BoxErrorNon-target_family=wasm
A boxed request-building failure.
SharedErrorNon-target_family=wasm
A request-building failure shared by every clone of the error that holds it.