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§
Sourcefn user_message(&self) -> Option<&str>
fn user_message(&self) -> Option<&str>
获取用户友好消息
Sourcefn request_id(&self) -> Option<&str>
fn request_id(&self) -> Option<&str>
获取请求ID
Sourcefn get_context(&self, key: &str) -> Option<&str>
fn get_context(&self, key: &str) -> Option<&str>
获取上下文信息
Sourcefn all_context(&self) -> &HashMap<String, String>
fn all_context(&self) -> &HashMap<String, String>
获取所有上下文信息