pub struct ErrorEvent {
pub error: LarkAPIError,
pub timestamp: SystemTime,
pub category: ErrorHandlingCategory,
pub error_code: Option<LarkErrorCode>,
pub is_retryable: bool,
pub processing_time: Option<Duration>,
pub context: HashMap<String, String>,
}Expand description
错误事件记录
Fields§
§error: LarkAPIError错误实例
timestamp: SystemTime发生时间
category: ErrorHandlingCategory错误分类
error_code: Option<LarkErrorCode>错误码(如果是API错误)
is_retryable: bool是否可重试
processing_time: Option<Duration>处理耗时(如果有)
context: HashMap<String, String>上下文信息
Implementations§
Source§impl ErrorEvent
impl ErrorEvent
Sourcepub fn from_error(error: LarkAPIError) -> Self
pub fn from_error(error: LarkAPIError) -> Self
从LarkAPIError创建错误事件
Sourcepub fn with_context(self, key: &str, value: &str) -> Self
pub fn with_context(self, key: &str, value: &str) -> Self
添加上下文信息
Sourcepub fn with_processing_time(self, duration: Duration) -> Self
pub fn with_processing_time(self, duration: Duration) -> Self
设置处理耗时
Sourcepub fn severity_level(&self) -> ErrorSeverity
pub fn severity_level(&self) -> ErrorSeverity
获取错误严重级别
Trait Implementations§
Source§impl Clone for ErrorEvent
impl Clone for ErrorEvent
Source§fn clone(&self) -> ErrorEvent
fn clone(&self) -> ErrorEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ErrorEvent
impl RefUnwindSafe for ErrorEvent
impl Send for ErrorEvent
impl Sync for ErrorEvent
impl Unpin for ErrorEvent
impl UnwindSafe for ErrorEvent
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