#[non_exhaustive]pub enum Error {
Api {
status: u16,
message: String,
},
InvalidBaseUrl(String),
Http(Error),
Json(Error),
Base64(DecodeError),
Stream(String),
}Expand description
Errors returned by the SDK.
Error::Api is the structured gateway error parsed from the canonical
{"error":{"message":"..."}} envelope (see SPEC.md). Everything else is a
transport or decoding failure.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Api
A non-2xx response from the gateway, carrying its HTTP status and the
error.message field from the envelope.
Status codes (per SPEC.md): 400 bad request · 401 missing/invalid key · 403 blocked or model-not-allowed · 404 no route for model · 429 key suspended (limiter) · 502 all upstreams failed.
Fields
InvalidBaseUrl(String)
The configured base URL could not be parsed.
Http(Error)
An HTTP / transport-level failure (connection, TLS, timeout, …).
Json(Error)
A JSON body could not be (de)serialised.
Base64(DecodeError)
A base64 embedding payload could not be decoded.
Stream(String)
The server sent a malformed SSE / NDJSON stream.
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()