pub struct ModelHttpError {
pub kind: HttpErrorKind,
pub message: String,
pub retry_after: Option<Duration>,
}Expand description
HTTP-level error (connection, timeout, etc.).
Fields§
§kind: HttpErrorKindError kind classification.
message: StringError message.
retry_after: Option<Duration>Retry-after duration if provided by the server.
Implementations§
Source§impl ModelHttpError
impl ModelHttpError
Sourcepub fn new(kind: HttpErrorKind, message: impl Into<String>) -> Self
pub fn new(kind: HttpErrorKind, message: impl Into<String>) -> Self
Create a new HTTP error.
Sourcepub fn connection(message: impl Into<String>) -> Self
pub fn connection(message: impl Into<String>) -> Self
Create a connection error.
Sourcepub fn response(status: Option<u16>, message: impl Into<String>) -> Self
pub fn response(status: Option<u16>, message: impl Into<String>) -> Self
Create a response error with an optional status code.
Sourcepub fn with_retry_after(self, retry_after: Duration) -> Self
pub fn with_retry_after(self, retry_after: Duration) -> Self
Set the retry-after duration.
Trait Implementations§
Source§impl Clone for ModelHttpError
impl Clone for ModelHttpError
Source§fn clone(&self) -> ModelHttpError
fn clone(&self) -> ModelHttpError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ModelHttpError
impl Debug for ModelHttpError
Source§impl Display for ModelHttpError
impl Display for ModelHttpError
Source§impl Error for ModelHttpError
impl Error for ModelHttpError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<ModelHttpError> for SerdesAiError
impl From<ModelHttpError> for SerdesAiError
Source§fn from(source: ModelHttpError) -> Self
fn from(source: ModelHttpError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ModelHttpError
impl RefUnwindSafe for ModelHttpError
impl Send for ModelHttpError
impl Sync for ModelHttpError
impl Unpin for ModelHttpError
impl UnwindSafe for ModelHttpError
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
Mutably borrows from an owned value. Read more