pub struct ChatError {
pub source: AppError,
pub finish_reason: Option<String>,
pub prompt_tokens: Option<u32>,
pub completion_tokens: Option<u32>,
pub retry_class: AttemptOutcome,
}Expand description
OpenRouterChatClient::complete failure (GAP-SG-72-chat / GAP-SG-72
reauditor addendum).
Wraps the underlying AppError with whatever truncation diagnostics were
available at the point of failure. finish_reason/token fields are None
when the failure happened before a response was parsed (network error, a
permanent 4xx, or exhausted retries) — only failures that occur AFTER a
ChatResponse was successfully decoded (JSON-repair or shape-guard
failures) carry them.
retry_class is the retry verdict computed AT THE ORIGIN (the exact HTTP
status, or the provider’s structured error code), never inferred
downstream from source.to_string(). The enrich queue consumes this field
directly instead of pattern-matching the formatted message.
Fields§
§source: AppErrorUnderlying cause, preserved via source() rather than restated.
finish_reason: Option<String>choices[0].finish_reason from the response that led to this error,
when one was decoded.
prompt_tokens: Option<u32>usage.prompt_tokens from the response that led to this error, when
one was decoded.
completion_tokens: Option<u32>usage.completion_tokens from the response that led to this error,
when one was decoded.
retry_class: AttemptOutcomeTyped retry verdict computed where the failure originated (HTTP
status / provider code), not by matching source’s message.
Trait Implementations§
Source§impl Error for ChatError
impl Error for ChatError
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()
Auto Trait Implementations§
impl !RefUnwindSafe for ChatError
impl !UnwindSafe for ChatError
impl Freeze for ChatError
impl Send for ChatError
impl Sync for ChatError
impl Unpin for ChatError
impl UnsafeUnpin for ChatError
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<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.