#[non_exhaustive]pub enum Error {
Auth(String),
TokenLimit(String),
InvalidConfig(String),
Api(String),
}Expand description
Why a client could not be built, or a request could not be answered.
Transient failures (connection errors, HTTP 429, 5xx) are retried inside
Client::ask and only surface as Error::Api once the retries are
spent. The other variants are returned at once, because retrying cannot help.
The enum is #[non_exhaustive]: a later version may tell more failures apart, so a match
needs a wildcard arm. Error::message and Display give the text of any variant.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Auth(String)
Missing, blank, unsendable or rejected credentials (HTTP 401 or 403).
TokenLimit(String)
The request exceeded the model’s context (max_tokens_exceeded, or HTTP 413). Ask fewer
questions, or about less state, and retry.
InvalidConfig(String)
A Config no request could be sent with: a base URL that is not an
absolute http or https URL, or a user agent that is not a valid header value.
Reported by Client::new, before anything is sent.
Api(String)
Anything else: an unreadable response, an unexpected status, or retries exhausted.
Implementations§
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
1.30.0 · 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()