#[non_exhaustive]pub enum VerifyError {
AuthFailed {
detail: String,
},
NotFound {
requested_url: String,
suggested_url: Option<String>,
},
Unreachable {
proxy_hint: bool,
},
ModelNotFound {
available: Vec<String>,
},
ProtocolMismatch {
expect: Protocol,
},
MissingExtraField {
key: String,
},
Malformed {
detail: String,
},
}Expand description
验证 / 调用失败的结构化原因。
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
AuthFailed
401 / 403 —— 密钥无效或已过期。
NotFound
404 —— 端点不存在。多半是 base_url 缺版本段。
suggested_url 非空时,调用方应提供「一键改用」按钮。
Fields
Unreachable
连不上(超时 / DNS / TLS)。proxy_hint 为真时建议提示用户配代理。
ModelNotFound
端点可达,但它不认当前填的模型名。available 是端点返回的真实清单。
ProtocolMismatch
密钥只接受另一种协议(典型:中转站的 key 限定 /v1/messages)。
MissingExtraField
服务商要求的专有字段没填(如豆包 TTS 的 appid)。
调用方应在发起验证之前就用它禁用按钮 —— 禁用态优于「点了才报错」。
Malformed
端点返回了预期之外的内容(解析失败等)。兜底变体。
Implementations§
Source§impl VerifyError
impl VerifyError
Sourcepub fn is_actionable(&self) -> bool
pub fn is_actionable(&self) -> bool
这个错误是否可能通过「改配置」解决(而非重试)。
调用方据此决定给「重试」还是给「去修改」按钮。
Trait Implementations§
Source§impl Clone for VerifyError
impl Clone for VerifyError
Source§impl Debug for VerifyError
impl Debug for VerifyError
Source§impl Display for VerifyError
impl Display for VerifyError
impl Eq for VerifyError
Source§impl Error for VerifyError
impl Error for VerifyError
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 VerifyError
impl PartialEq for VerifyError
Source§impl Serialize for VerifyError
impl Serialize for VerifyError
impl StructuralPartialEq for VerifyError
Auto Trait Implementations§
impl Freeze for VerifyError
impl RefUnwindSafe for VerifyError
impl Send for VerifyError
impl Sync for VerifyError
impl Unpin for VerifyError
impl UnsafeUnpin for VerifyError
impl UnwindSafe for VerifyError
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