Skip to main content

ModelErrorKind

Enum ModelErrorKind 

Source
#[non_exhaustive]
pub enum ModelErrorKind {
Show 19 variants RateLimited, Overloaded, Unavailable, Transport, Timeout, StreamInterrupted, ContextTooLong, InvalidRequest, NotFound, Auth, NoCredentials, Billing, Denied, ServerError, Protocol, Cancelled, Unsupported, NotRecorded, ProvidersUnavailable,
}
Expand description

What kind of failure a model call had. Assigned once, by the protocol client that saw it; everything above reads it.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

RateLimited

429, or a body saying rate_limit_error.

§

Overloaded

503, 529, or a body saying overloaded_error.

§

Unavailable

408, 500, 502, 504: the server side failed and the request was fine.

§

Transport

Nothing usable came back: connection reset, DNS, TLS.

§

Timeout

No response headers, or no next event, within the idle window.

§

StreamInterrupted

The stream broke off before the message ended.

§

ContextTooLong

The request was refused for its size.

§

InvalidRequest

Any other 4xx.

§

NotFound

§

Auth

401, 403.

§

NoCredentials

There was no credential to send, so nothing was sent.

§

Billing

402, or a body saying billing_error.

§

Denied

The egress policy refused the connection.

§

ServerError

Any other 5xx.

§

Protocol

The response could not be read: SSE framing, JSON shape.

§

Cancelled

§

Unsupported

The provider cannot do what the call asked of it.

§

NotRecorded

A replay was asked for a call its recording does not hold, and the call is one a replay is allowed to go without — the caller skips it rather than reporting a failure.

§

ProvidersUnavailable

Every provider in the order was out of quota or failed to take the call; the message says why for each.

Implementations§

Source§

impl ModelErrorKind

Source

pub fn as_str(self) -> &'static str

Source

pub fn request_failure(self) -> RequestFailure

What a client’s backoff policy is told about a request that failed before its first byte.

Source

pub fn transient(self) -> bool

Whether the same request, sent again a little later, may well succeed.

Trait Implementations§

Source§

impl Clone for ModelErrorKind

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ModelErrorKind

Source§

impl Debug for ModelErrorKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ModelErrorKind

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for ModelErrorKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ModelErrorKind

Source§

impl From<ModelErrorKind> for FailureKind

Source§

fn from(kind: ModelErrorKind) -> Self

Converts to this type from the input type.
Source§

impl Hash for ModelErrorKind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ModelErrorKind

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ModelErrorKind

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ModelErrorKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more