pub enum ProviderError {
Show 15 variants
Network {
message: String,
detail: Option<String>,
},
RateLimit {
retry_after_ms: u64,
},
Overloaded,
Timeout {
timeout_ms: u64,
},
Cancelled,
Config(String),
Auth(String),
TokenLimit {
actual: usize,
limit: usize,
},
Format(String),
ModelNotFound(String),
UnsupportedCapability {
model: String,
capability: String,
},
NoModelForCapability {
required: CapabilityRequest,
},
Internal {
status: u16,
message: String,
},
NoRoute(String),
KeySource(String),
}Expand description
Provider 错误类型
分类:
- Transient(可重试):Network, RateLimit, Overloaded, Timeout
- Fatal(不可重试):Cancelled, Config, Auth, TokenLimit, Format, 等
Variants§
Network
RateLimit
Overloaded
Timeout
Cancelled
Config(String)
Auth(String)
TokenLimit
Format(String)
ModelNotFound(String)
UnsupportedCapability
NoModelForCapability
Fields
§
required: CapabilityRequestInternal
NoRoute(String)
KeySource(String)
Implementations§
Source§impl ProviderError
impl ProviderError
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
判断是否为可重试错误
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
判断是否为用户主动取消
Sourcepub fn retry_after(&self) -> Option<Duration>
pub fn retry_after(&self) -> Option<Duration>
建议的重试等待时间
Trait Implementations§
Source§impl Debug for ProviderError
impl Debug for ProviderError
Source§impl Display for ProviderError
impl Display for ProviderError
Source§impl Error for ProviderError
impl Error for ProviderError
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<Error> for ProviderError
impl From<Error> for ProviderError
Auto Trait Implementations§
impl Freeze for ProviderError
impl RefUnwindSafe for ProviderError
impl Send for ProviderError
impl Sync for ProviderError
impl Unpin for ProviderError
impl UnsafeUnpin for ProviderError
impl UnwindSafe for ProviderError
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