pub enum BackendError {
Generic {
status_code: i64,
body: String,
},
ThinkingNotSupported {
model: String,
status_code: i64,
body: String,
},
}Expand description
Error indicating that the backend request failed.
Variants§
Generic
A generic backend failure with status code and body description.
Fields
ThinkingNotSupported
Error indicating that thinking mode is not supported by the model.
Implementations§
Source§impl BackendError
impl BackendError
Sourcepub fn new(status_code: i64, body: impl Into<String>) -> Self
pub fn new(status_code: i64, body: impl Into<String>) -> Self
Creates a new generic BackendError.
Sourcepub fn status_code(&self) -> i64
pub fn status_code(&self) -> i64
Returns the HTTP/API status code carried by this error (0 for a
transport-level failure where no HTTP response was received).
Sourcepub fn status_from_display(message: &str) -> Option<i64>
pub fn status_from_display(message: &str) -> Option<i64>
Recovers the status code from a BackendError::Generic Display string
(Backend error (status N): ...).
This is for boundaries where an upstream error has already been flattened
to text (for example a stream-start failure surfaced as a StreamError).
Typed call sites use BackendError::status_code instead, so this parser
is never applied to arbitrary wrapped messages.
Sourcepub fn thinking_not_supported(model: impl Into<String>) -> Self
pub fn thinking_not_supported(model: impl Into<String>) -> Self
Creates a ThinkingNotSupported backend error.
Trait Implementations§
Source§impl Debug for BackendError
impl Debug for BackendError
Source§impl Display for BackendError
impl Display for BackendError
Source§impl Error for BackendError
impl Error for BackendError
1.30.0 · 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()
Source§impl From<BackendError> for ForgeError
impl From<BackendError> for ForgeError
Source§fn from(source: BackendError) -> Self
fn from(source: BackendError) -> Self
Auto Trait Implementations§
impl Freeze for BackendError
impl RefUnwindSafe for BackendError
impl Send for BackendError
impl Sync for BackendError
impl Unpin for BackendError
impl UnsafeUnpin for BackendError
impl UnwindSafe for BackendError
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
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 more