pub struct ErrorDiagnostic {
pub kind: String,
pub message: String,
pub retriable: bool,
pub source: Option<String>,
pub category: ErrorCategory,
pub status_code: Option<u16>,
pub retry_after: Option<Duration>,
}Expand description
统一的错误诊断信息
设计目标:
- 不破坏现有错误枚举与调用点
- 让上层能拿到结构化的诊断字段
§字段说明
kind: 错误大类(provider/tool/runtime/skill/memory/channel)message: 人类可读信息retriable: 是否建议重试source: 可选的错误来源字符串category: 错误详细类别status_code: 可选的 HTTP 状态码retry_after: 可选的重试等待时间
Fields§
§kind: String错误类型
message: String错误消息
retriable: bool是否可重试
source: Option<String>错误来源
category: ErrorCategory错误详细类别
status_code: Option<u16>HTTP 状态码(如果有)
retry_after: Option<Duration>建议重试等待时间
Trait Implementations§
Source§impl Clone for ErrorDiagnostic
impl Clone for ErrorDiagnostic
Source§fn clone(&self) -> ErrorDiagnostic
fn clone(&self) -> ErrorDiagnostic
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ErrorDiagnostic
impl Debug for ErrorDiagnostic
Source§impl Default for ErrorDiagnostic
impl Default for ErrorDiagnostic
Source§impl PartialEq for ErrorDiagnostic
impl PartialEq for ErrorDiagnostic
Source§fn eq(&self, other: &ErrorDiagnostic) -> bool
fn eq(&self, other: &ErrorDiagnostic) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for ErrorDiagnostic
impl StructuralPartialEq for ErrorDiagnostic
Auto Trait Implementations§
impl Freeze for ErrorDiagnostic
impl RefUnwindSafe for ErrorDiagnostic
impl Send for ErrorDiagnostic
impl Sync for ErrorDiagnostic
impl Unpin for ErrorDiagnostic
impl UnsafeUnpin for ErrorDiagnostic
impl UnwindSafe for ErrorDiagnostic
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