Expand description
统一错误类型定义 rucora-core 的统一错误类型定义(增强版)
§概述
本模块提供细粒度的错误分类,支持:
- 错误类型识别
- 可重试性判断
- 结构化诊断信息
- 错误来源追踪
§使用示例
use rucora_core::error::{ProviderError, ErrorCategory};
let error = ProviderError::RateLimit {
retry_after: Some(std::time::Duration::from_secs(60)),
message: "API 限流".to_string(),
};
// 判断是否可重试
if error.is_retriable() {
println!("可以重试");
}
// 获取错误类别
match error.category() {
ErrorCategory::RateLimit => println!("限流错误"),
_ => println!("其他错误"),
}Structs§
- Error
Diagnostic - 统一的错误诊断信息
Enums§
- Agent
Error - Agent 错误
- Channel
Error - Channel 错误
- Error
Category - 错误类别枚举
- Memory
Error - Memory 错误
- Provider
Error - Provider 错误(增强版)
- Skill
Error - Skill 错误
- Tool
Error - Tool 错误(增强版)
Traits§
- Diagnostic
Error - 为 core 层错误提供统一诊断能力