Skip to main content

ErrorContextTrait

Trait ErrorContextTrait 

Source
pub trait ErrorContextTrait {
    // Required methods
    fn user_message(&self) -> Option<&str>;
    fn request_id(&self) -> Option<&str>;
    fn operation(&self) -> Option<&str>;
    fn component(&self) -> Option<&str>;
    fn timestamp(&self) -> Option<DateTime<Utc>>;
    fn get_context(&self, key: &str) -> Option<&str>;
    fn all_context(&self) -> &HashMap<String, String>;

    // Provided methods
    fn has_context(&self, key: &str) -> bool { ... }
    fn is_empty(&self) -> bool { ... }
}
Expand description

错误上下文特征

Required Methods§

Source

fn user_message(&self) -> Option<&str>

获取用户友好消息

Source

fn request_id(&self) -> Option<&str>

获取请求ID

Source

fn operation(&self) -> Option<&str>

获取操作名称

Source

fn component(&self) -> Option<&str>

获取组件名称

Source

fn timestamp(&self) -> Option<DateTime<Utc>>

获取时间戳

Source

fn get_context(&self, key: &str) -> Option<&str>

获取上下文信息

Source

fn all_context(&self) -> &HashMap<String, String>

获取所有上下文信息

Provided Methods§

Source

fn has_context(&self, key: &str) -> bool

检查是否有指定的上下文键

Source

fn is_empty(&self) -> bool

判断是否为空

Implementors§