pub enum LlmError {
InvalidRequest {
message: String,
},
UnsupportedFeature {
feature: String,
},
DuplicateSystemPrompt,
Network {
detail: String,
},
Timeout {
detail: String,
},
Provider {
provider: String,
status: Option<u16>,
code: Option<String>,
message: String,
},
Parse {
detail: String,
},
UnexpectedEof,
}Expand description
LLM API 错误。
错误分类:
- InvalidRequest — 调用方构造了非法请求(发请求前本地可发现)
- UnsupportedFeature — SDK 不支持的功能(能力边界)
- DuplicateSystemPrompt — 系统提示冲突
- Provider — 请求已发出,对端返回错误(401/429/500/…)
- Parse — 响应体 JSON 解析失败
- Network — 网络层错误
- Timeout — 请求超时
- UnexpectedEof — 流式输出意外结束
Variants§
InvalidRequest
UnsupportedFeature
DuplicateSystemPrompt
Network
Timeout
Provider
Parse
UnexpectedEof
Trait Implementations§
Source§impl Error for LlmError
impl Error for LlmError
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 LlmError
impl RefUnwindSafe for LlmError
impl Send for LlmError
impl Sync for LlmError
impl Unpin for LlmError
impl UnsafeUnpin for LlmError
impl UnwindSafe for LlmError
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