#[non_exhaustive]pub enum Error {
ClientBuild(TransportError),
#[non_exhaustive] MissingApiKey {
provider: &'static str,
env: &'static str,
},
#[non_exhaustive] Request {
provider: &'static str,
source: TransportError,
},
#[non_exhaustive] Api {
provider: &'static str,
status: u16,
body: String,
},
#[non_exhaustive] Decode {
provider: &'static str,
source: TransportError,
},
#[non_exhaustive] CountMismatch {
provider: &'static str,
got: usize,
expected: usize,
},
#[non_exhaustive] DimMismatch {
provider: &'static str,
got: usize,
expected: usize,
},
}Expand description
Everything that can go wrong producing embeddings. Each variant carries the provider that raised it so a caller can log or match without string-scraping.
The struct variants are #[non_exhaustive] so fields can be added (e.g. a
retry_after on Error::Api) without a breaking release; match them with
a trailing ...
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ClientBuild(TransportError)
Building the underlying HTTP client failed (bad TLS config, etc.).
#[non_exhaustive]MissingApiKey
Voyage was selected but no API key was supplied and the environment variable is unset.
Fields
This variant is marked as non-exhaustive
env: &'static strThe environment variable that was consulted (VOYAGE_API_KEY_ENV).
#[non_exhaustive]Request
The HTTP request never completed (connection refused, timeout, DNS, …). For Ollama this usually means the server is not running.
Fields
This variant is marked as non-exhaustive
source: TransportErrorThe underlying transport error.
#[non_exhaustive]Api
The provider answered with a non-success status; body is its message.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]Decode
The success response could not be decoded into the expected shape.
Fields
This variant is marked as non-exhaustive
source: TransportErrorThe underlying transport error.
#[non_exhaustive]CountMismatch
The provider returned a different number of vectors than inputs given.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]DimMismatch
An output_dimension was pinned but a returned vector had a different
width - a schema-desync guard for callers that store into a fixed-width
column (e.g. pgvector vector(1024)).
Fields
This variant is marked as non-exhaustive
expected: usizeThe pinned ClientBuilder::output_dimension.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()