pub enum ProviderErrorKind {
Authentication {
message: String,
kind: AuthErrorKind,
},
RateLimit {
message: String,
retry_after: Option<Duration>,
},
QuotaExceeded {
message: String,
},
InvalidRequest {
message: String,
},
ContentFiltered {
message: String,
},
ServerError {
message: String,
status: u16,
retry_after: Option<Duration>,
},
Transport {
message: String,
},
InvalidResponse {
message: String,
},
Unknown {
message: String,
},
}Expand description
Provider 错误分类。
每种分类自带 retryable 语义,Agent loop 据此决定重试策略。 可序列化以便持久化到 Session 记录中。
Variants§
Authentication
API Key 缺失、无效、过期、权限不足。
RateLimit
请求频率超限(HTTP 429)。
QuotaExceeded
配额/余额耗尽(需充值或切换账户)。
InvalidRequest
请求参数非法(prompt 过长、无效模型名等)。
ContentFiltered
内容被安全策略过滤。
ServerError
Provider 服务端错误(5xx)。
Transport
网络/传输层错误(DNS 失败、连接超时、SSL 等)。
InvalidResponse
Provider 返回了无法解析的响应。
Unknown
未知 Provider 错误。
Implementations§
Trait Implementations§
Source§impl Clone for ProviderErrorKind
impl Clone for ProviderErrorKind
Source§fn clone(&self) -> ProviderErrorKind
fn clone(&self) -> ProviderErrorKind
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ProviderErrorKind
impl Debug for ProviderErrorKind
Source§impl<'de> Deserialize<'de> for ProviderErrorKind
impl<'de> Deserialize<'de> for ProviderErrorKind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ProviderErrorKind
impl Display for ProviderErrorKind
Source§impl Error for ProviderErrorKind
impl Error for ProviderErrorKind
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()
Auto Trait Implementations§
impl Freeze for ProviderErrorKind
impl RefUnwindSafe for ProviderErrorKind
impl Send for ProviderErrorKind
impl Sync for ProviderErrorKind
impl Unpin for ProviderErrorKind
impl UnsafeUnpin for ProviderErrorKind
impl UnwindSafe for ProviderErrorKind
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