#[non_exhaustive]pub enum StreamErrorKind {
RateLimited,
ServerError,
InvalidRequest,
Unknown,
}Expand description
Classification of a StreamDelta::Error event.
Mirrors ChatOutcome’s error
variants so providers that emit errors via streaming preserve the
same precision that non-streaming chat() callers see — every
supported provider can map its underlying error (HTTP status,
validation failure, mid-stream disconnect) directly onto one of
these categories at the construction site.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
RateLimited
Provider returned HTTP 429 / explicit rate-limit signal.
ServerError
Provider returned HTTP 5xx, the connection dropped mid-stream, or the provider reported a transient runtime failure.
InvalidRequest
Caller-side error: validation failure before dispatch, HTTP 4xx other than 429, or a non-retriable provider rejection.
Unknown
Escape hatch for a streaming error a provider could not classify into one of the categories above.
Producers should prefer a specific variant whenever the
underlying signal (HTTP status, validation failure, mid-stream
disconnect) allows it; Unknown exists so future error sources
and providers can be added without a breaking change. It is
treated as non-recoverable by StreamErrorKind::is_recoverable
(callers should not blindly retry an unclassified failure).
Implementations§
Source§impl StreamErrorKind
impl StreamErrorKind
Sourcepub const fn is_recoverable(self) -> bool
pub const fn is_recoverable(self) -> bool
true when the error is potentially transient and the caller
may retry. Rate-limit and server errors are recoverable;
invalid-request is not.
Trait Implementations§
Source§impl Clone for StreamErrorKind
impl Clone for StreamErrorKind
Source§fn clone(&self) -> StreamErrorKind
fn clone(&self) -> StreamErrorKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for StreamErrorKind
Source§impl Debug for StreamErrorKind
impl Debug for StreamErrorKind
impl Eq for StreamErrorKind
Source§impl PartialEq for StreamErrorKind
impl PartialEq for StreamErrorKind
Source§fn eq(&self, other: &StreamErrorKind) -> bool
fn eq(&self, other: &StreamErrorKind) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for StreamErrorKind
Auto Trait Implementations§
impl Freeze for StreamErrorKind
impl RefUnwindSafe for StreamErrorKind
impl Send for StreamErrorKind
impl Sync for StreamErrorKind
impl Unpin for StreamErrorKind
impl UnsafeUnpin for StreamErrorKind
impl UnwindSafe for StreamErrorKind
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> Equivalent<K> for Q
impl<Q, K> Equivalent<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.