fix(weixin): report safe delivery diagnostics

This commit is contained in:
xmanrui 2026-08-26 22:18:12 +08:00
parent 64587b3b61
commit 91e2d5962a
6 changed files with 390 additions and 201 deletions

View file

@ -709,8 +709,13 @@ export function createWeixinApi({ fetchImpl = fetch } = {}) {
base_info: baseInfo(),
},
});
if (response?.ret !== undefined && response.ret !== 0) {
throw new WeixinApiError('send-rejected', '微信服务拒绝了回复消息。');
const sendRejection = rejectedProviderResponse(response);
if (sendRejection) {
throw new WeixinApiError(
'send-rejected',
'微信服务拒绝了回复消息。',
{ providerCode: sendRejection },
);
}
return true;
},