pub enum ErrorCode {
Show 40 variants
InvalidInput = 1_001,
MissingParameter = 1_002,
Cancelled = 1_003,
Timeout = 1_004,
NotImplemented = 1_005,
UnsupportedConfig = 1_006,
ToolNotFound = 2_001,
ToolValidation = 2_002,
ToolExecution = 2_003,
ToolSandboxed = 2_004,
PermissionDenied = 3_001,
PathNotAllowed = 3_002,
NetworkBlocked = 3_003,
HttpClientError = 4_001,
HttpServerError = 4_002,
ApiUnauthorized = 4_003,
ApiRateLimited = 4_004,
ConnectionTimeout = 4_005,
ConnectionFailed = 4_006,
FileNotFound = 5_001,
FileReadError = 5_002,
FileWriteError = 5_003,
FilePermission = 5_004,
InvalidPath = 5_005,
DiskFull = 5_006,
SessionNotFound = 6_001,
SessionExpired = 6_002,
SessionCapReached = 6_003,
TranscriptCorrupt = 6_004,
ModelUnsupportedParam = 7_001,
ContextWindowExceeded = 7_002,
ModelParseError = 7_003,
ModelEmptyResponse = 7_004,
StreamAborted = 7_005,
McpConnectFailed = 8_001,
McpToolCallFailed = 8_002,
McpOAuthFailed = 8_003,
InternalInconsistency = 9_001,
ChannelClosed = 9_002,
Internal = 9_999,
}Expand description
全局错误码。
编码规则:
1xxx— 通用 / 输入验证2xxx— 工具执行3xxx— 权限 / 安全4xxx— 网络 / API5xxx— 文件 / IO6xxx— 会话 / 状态7xxx— 模型 / LLM8xxx— MCP 协议9xxx— 内部 / 未分类
Variants§
InvalidInput = 1_001
输入格式不符合预期
MissingParameter = 1_002
缺少必填参数
Cancelled = 1_003
操作被用户取消
Timeout = 1_004
操作超时
NotImplemented = 1_005
功能未实现
UnsupportedConfig = 1_006
不支持的配置
ToolNotFound = 2_001
工具未找到
ToolValidation = 2_002
工具输入校验失败
ToolExecution = 2_003
工具执行失败
ToolSandboxed = 2_004
工具被沙箱拒绝
PermissionDenied = 3_001
权限拒绝
PathNotAllowed = 3_002
路径不在允许范围内
NetworkBlocked = 3_003
网络访问被策略阻止
HttpClientError = 4_001
HTTP 客户端错误 (4xx)
HttpServerError = 4_002
HTTP 服务端错误 (5xx)
API 认证失败
ApiRateLimited = 4_004
API 限流
ConnectionTimeout = 4_005
连接超时
ConnectionFailed = 4_006
DNS / TCP 连接失败
FileNotFound = 5_001
文件不存在
FileReadError = 5_002
文件读取失败
FileWriteError = 5_003
文件写入失败
FilePermission = 5_004
文件权限不足
InvalidPath = 5_005
路径格式不合法
DiskFull = 5_006
磁盘空间不足
SessionNotFound = 6_001
会话不存在
SessionExpired = 6_002
会话已过期
SessionCapReached = 6_003
会话达到上限
TranscriptCorrupt = 6_004
JSONL 格式错误
ModelUnsupportedParam = 7_001
模型不支持的参数
ContextWindowExceeded = 7_002
token 超出上下文窗口
ModelParseError = 7_003
模型响应解析失败
ModelEmptyResponse = 7_004
模型返回空响应
StreamAborted = 7_005
流意外终止
McpConnectFailed = 8_001
MCP 服务连接失败
McpToolCallFailed = 8_002
MCP 工具调用失败
McpOAuthFailed = 8_003
MCP OAuth 流程失败
InternalInconsistency = 9_001
内部状态不一致
ChannelClosed = 9_002
channel 发送端断开
Internal = 9_999
未分类的内部错误
Implementations§
Trait Implementations§
impl Copy for ErrorCode
impl Eq for ErrorCode
impl StructuralPartialEq for ErrorCode
Auto Trait Implementations§
impl Forget for ErrorCode
impl Freeze for ErrorCode
impl Move for ErrorCode
impl RefUnwindSafe for ErrorCode
impl Send for ErrorCode
impl Sync for ErrorCode
impl Unpin for ErrorCode
impl UnsafeUnpin for ErrorCode
impl UnwindSafe for ErrorCode
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