#[non_exhaustive]pub struct ModelError {
pub kind: ModelErrorKind,
pub status: Option<u16>,
pub retry_after: Option<Duration>,
pub message: String,
}Expand description
A failed model call, as the protocol client classified it.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.kind: ModelErrorKind§status: Option<u16>The HTTP status, when the failure had one.
retry_after: Option<Duration>How long the provider asked to be left alone, when it said.
message: StringImplementations§
Source§impl ModelError
impl ModelError
pub fn new(kind: ModelErrorKind, message: impl Into<String>) -> Self
pub fn with_status(self, status: u16) -> Self
pub fn with_retry_after(self, retry_after: Option<Duration>) -> Self
pub fn cancelled() -> Self
pub fn rate_limited() -> Self
pub fn overloaded() -> Self
Sourcepub fn unaffordable(why: &str) -> Self
pub fn unaffordable(why: &str) -> Self
A call not sent: the budget it would spend into cannot pay for it.
pub fn auth(message: impl Into<String>) -> Self
pub fn transport(message: impl Into<String>) -> Self
pub fn timeout(message: impl Into<String>) -> Self
pub fn stream_interrupted(message: impl Into<String>) -> Self
pub fn protocol(message: impl Into<String>) -> Self
pub fn invalid_request(message: impl Into<String>) -> Self
pub fn unsupported(message: impl Into<String>) -> Self
pub fn not_recorded(message: impl Into<String>) -> Self
Trait Implementations§
Source§impl Clone for ModelError
impl Clone for ModelError
Source§impl Debug for ModelError
impl Debug for ModelError
Source§impl Display for ModelError
impl Display for ModelError
impl Eq for ModelError
Source§impl Error for ModelError
impl Error for ModelError
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 PartialEq for ModelError
impl PartialEq for ModelError
impl StructuralPartialEq for ModelError
Auto Trait Implementations§
impl Forget for ModelError
impl Freeze for ModelError
impl Move for ModelError
impl RefUnwindSafe for ModelError
impl Send for ModelError
impl Sync for ModelError
impl Unpin for ModelError
impl UnsafeUnpin for ModelError
impl UnwindSafe for ModelError
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