Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions rust/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Comment on lines +236 to +240

Copilot AI Apr 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message extraction here (errmsg -> message -> raw text) differs from the earlier status >= 400 branch, which only checks errmsg. Consider extracting a small helper/closure to compute the API error message once and reusing it in both branches to keep behavior consistent and avoid duplicated parsing logic.

Copilot uses AI. Check for mistakes.
http_status: status,
errcode: errcode as i32,
});
}
}

Ok(value)
}
}
Expand Down
Loading