From 9ffa2893531bff7bec24de61089bb76d10224884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9E=97=E4=BC=9F?= Date: Fri, 24 Apr 2026 17:59:37 +0800 Subject: [PATCH] Check errcode --- rust/Cargo.lock | 2 +- rust/src/protocol.rs | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 95caf6b..d06e862 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -1764,7 +1764,7 @@ dependencies = [ [[package]] name = "wechatbot" -version = "0.3.0" +version = "0.3.1" dependencies = [ "aes", "base64", diff --git a/rust/src/protocol.rs b/rust/src/protocol.rs index ad4db6c..f5c6059 100644 --- a/rust/src/protocol.rs +++ b/rust/src/protocol.rs @@ -230,6 +230,20 @@ impl ILinkClient { }); } + if let Some(errcode) = value["errcode"].as_i64() { + if errcode != 0 { + return Err(WeChatBotError::Api { + message: value["errmsg"] + .as_str() + .or_else(|| value["message"].as_str()) + .unwrap_or(&text) + .to_string(), + http_status: status, + errcode: errcode as i32, + }); + } + } + Ok(value) } }