wx_rust_common/error/wx_runtime_exception.rs
1//! WxRust 专用运行时异常。
2//!
3//! 对应 Java `me.chanjar.weixin.common.error.WxRuntimeException`。
4
5/// WxRust 专用运行时异常。
6///
7/// 用于执行引擎的致命错误(重试超限、token 获取超时、中断等)——这些错误
8/// 在 Java 中抛 `WxRuntimeException`(unchecked),Rust 中作为 [`crate::error::WxErrorException`]
9/// 的 `Runtime` 变体承载。
10#[derive(Debug, Clone, thiserror::Error)]
11#[error("{message}")]
12pub struct WxRuntimeError {
13 /// 运行时错误信息
14 pub message: String,
15}
16
17impl WxRuntimeError {
18 /// 用错误信息构建运行时异常。
19 pub fn new(message: impl Into<String>) -> Self {
20 Self {
21 message: message.into(),
22 }
23 }
24}