#[non_exhaustive]pub enum Error {
Auth,
Invalid {
detail: String,
},
RateLimited {
retry_after: Option<Duration>,
},
Overloaded {
retry_after: Option<Duration>,
},
Transport(Box<dyn Error + Send + Sync>),
UnexpectedStatus {
status: u16,
body: String,
},
Protocol {
detail: String,
},
Unsure {
question: String,
value: f64,
threshold: f64,
},
Config {
detail: String,
},
}Expand description
Everything that can go wrong, from the wire to the policy.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Auth
401: missing or invalid API key.
Invalid
422: the request body failed validation. detail is the verbatim response body.
RateLimited
429 after every retry was used.
Overloaded
529 after every retry was used.
Transport(Box<dyn Error + Send + Sync>)
Connection, TLS, timeout, or body-read failure. A failure to connect — refused, reset, or a TLS handshake — is retried inside the same budget as a throttle. A timeout of any phase and a body failure are not: the client sets one deadline over the whole attempt, so a connect-phase timeout cannot be told apart from a read timeout, and retrying either would multiply the wall time that deadline promises.
UnexpectedStatus
A status the API contract does not define.
Protocol
The response violated the contract: undecodable body, answer kind mismatch, unknown
option or level, probability outside 0..=1, missing answer for a question.
Unsure
The policy labelled the answer unsure and no fallback was given.
Fields
Config
Bad configuration: thresholds outside 0..=1, no_below > yes_above, missing key,
empty batch, unserialisable state, empty or duplicate rubric.
Implementations§
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()