Skip to main content

wx_rust_common/util/
log_exception_handler.rs

1//! 日志异常处理器。
2//!
3//! 对应 Java `me.chanjar.weixin.common.util.LogExceptionHandler`。
4
5use crate::api::WxErrorExceptionHandler;
6use crate::error::WxErrorException;
7
8/// 默认日志异常处理器:把异常记录到日志。
9#[derive(Debug, Clone, Default)]
10pub struct LogExceptionHandler;
11
12impl WxErrorExceptionHandler for LogExceptionHandler {
13    /// 记录错误异常。
14    ///
15    /// # 参数
16    /// - `e`:微信错误异常
17    fn handle(&self, e: WxErrorException) {
18        tracing::error!("Error happens: {e:?}");
19    }
20}