#[non_exhaustive]pub enum StatusRow {
Show 13 variants
Unauthorized,
Forbidden,
NotFound,
RequestTimeout,
ConnectionReset,
TooManyRequests,
ContextLength,
BadRequest,
InternalServerError,
ServiceUnavailable,
ContentFilter,
ExpiredCredential,
QuotaExhausted,
}Expand description
One wire failure and the error kind an adapter must map it onto.
Growable: match with a _ arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
HTTP 401 must become
Authentication —
not Authorization.
The key is wrong, and no other candidate configured with the same key
will do better.
Forbidden
HTTP 403 must become
Authorization. The
key is fine and this model is not entitled to it, which is a different
thing to tell an operator.
NotFound
HTTP 404 must become
ModelNotFound, so
the router moves to a candidate that exists instead of retrying a name
that does not.
RequestTimeout
HTTP 408 must become
Timeout. The provider is
saying the deadline passed on its side; it means the same as the
deadline passing on ours.
ConnectionReset
A socket that dies mid-call must become
Timeout or
Transport — never a
server error, and never something fatal.
TooManyRequests
HTTP 429 must become
RateLimited, carrying
whatever delay the response advertised.
ContextLength
An HTTP 400 the provider describes as a context-length problem must
become ContextOverflow,
so the runtime shrinks the prompt instead of re-sending it.
BadRequest
An HTTP 400 that is genuinely a bad request must become
InvalidRequest:
our request is wrong and every other provider will reject it too.
InternalServerError
HTTP 500 must become
Server.
HTTP 503 must become
Server as well: a busy
provider is retryable, not fatal.
ContentFilter
A safety filter must surface as
ContentFilter or
Refusal — as a kind, or
as a response finishing that way — never as a server error a policy
layer would retry.
ExpiredCredential
The vendor’s expired credential signal must become
CredentialExpired,
not Authentication.
Most vendors report it with the same 401 they use for a wrong key, so only the body tells them apart and only the adapter knows the shape. Getting it wrong strands a caller that holds a refresher: it is told the key is bad when refreshing would have fixed the call.
QuotaExhausted
The vendor’s quota or billing signal must become
QuotaExhausted, not
RateLimited.
Several vendors report an exhausted quota or an empty credit balance with HTTP 429, the same status as a rate limit. An adapter that reads the status alone makes the runtime sleep on a delay that will not help, burning the turn’s deadline for a balance only a human can refill.
Implementations§
Source§impl StatusRow
impl StatusRow
Sourcepub const fn http_status(self) -> Option<u16>
pub const fn http_status(self) -> Option<u16>
The HTTP status this row puts on the wire, when it is one.
ConnectionReset has none — the point is that
no status ever arrives — and ContentFilter
leaves the framing to the vendor.
Sourcepub const fn scenario(self) -> Option<Scenario>
pub const fn scenario(self) -> Option<Scenario>
The scenario a fixture mounts for this row.
ConnectionReset returns None: the suite
owns that one, because a reset is produced by a socket rather than by a
mock response.
Sourcepub const fn expected_kinds(self) -> &'static [&'static str]
pub const fn expected_kinds(self) -> &'static [&'static str]
The ProviderErrorKind labels this
row accepts.
One entry for every row but the two documented at the module level.
Sourcepub const fn expected_retry_class(self) -> RetryClass
pub const fn expected_retry_class(self) -> RetryClass
The RetryClass the kind this row requires must carry.
Every row has exactly one, including the two that accept two kinds:
timeout and transport are both Retry, and
content_filter and refusal are both Fatal.
The class is asserted separately from the kind because they can drift
apart, and it is the class the policy layer actually acts on.
Sourcepub const fn wire_description(self) -> &'static str
pub const fn wire_description(self) -> &'static str
How a failure message names what was put on the wire.
Sourcepub const fn accepts_finish(self, finish: FinishReason) -> bool
pub const fn accepts_finish(self, finish: FinishReason) -> bool
Returns true when a successful response finishing this way is an
acceptable answer for this row.
Only the content-filter row has one: every other row exists because a call failed, and a response where a failure was required is a defect.
Trait Implementations§
impl Copy for StatusRow
impl Eq for StatusRow
Source§impl Ord for StatusRow
impl Ord for StatusRow
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for StatusRow
impl PartialOrd for StatusRow
impl StructuralPartialEq for StatusRow
Auto Trait Implementations§
impl Freeze for StatusRow
impl RefUnwindSafe for StatusRow
impl Send for StatusRow
impl Sync for StatusRow
impl Unpin for StatusRow
impl UnsafeUnpin for StatusRow
impl UnwindSafe for StatusRow
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.