pub enum Error {
UnknownProvider(String),
ProviderDisabled(String),
Unsupported {
provider: String,
capability: &'static str,
},
MissingConfig(&'static str),
Api {
status: u16,
message: String,
},
Http(Error),
Parse(String),
MissingField(&'static str),
}Variants§
UnknownProvider(String)
ProviderDisabled(String)
厂商或模态未在 Cargo feature 中启用(例如启了 rerank 但未启 aliyun 仍选阿里云)。
Unsupported
该厂商在此模态下无实现,或能力仍为占位(如语音工厂)。
MissingConfig(&'static str)
Api
上游 HTTP 非 2xx;message 来自响应体(经各模态解析或拼接)。未知模型、鉴权失败、参数错误等通常落在此变体,而非单独的「模型」枚举分支。
Http(Error)
Parse(String)
MissingField(&'static str)
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
是否属于可安全重试的错误(幂等前提下)。
以下情况返回 true:
- HTTP 429 Too Many Requests
- HTTP 5xx 服务端错误
reqwest网络层错误(连接超时、连接重置等)
Sourcepub fn requires_human(&self) -> bool
pub fn requires_human(&self) -> bool
是否需要人工介入(鉴权失败、权限不足、资源不存在等)。
以下情况返回 true:
- HTTP 401 Unauthorized
- HTTP 403 Forbidden
- HTTP 404 Not Found
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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 Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl !UnwindSafe for Error
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
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.