feat(desktop-client): expand publisher error normalization

新增登录态失效与微信公众号外链缺失两类发布错误归一化,
将原本散落在适配器里的中文提示集中到 shared/publisher-errors,
让渲染层与 main 进程共用同一份用户可读文案。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-01 10:21:54 +08:00
parent 3436d9536d
commit 7b6ae0f6d0
3 changed files with 88 additions and 3 deletions
@@ -8,6 +8,10 @@ import {
sessionFetchText,
uploadHtmlImages,
} from "./common";
import {
WEIXIN_GZH_PUBLIC_URL_MISSING_MESSAGE,
normalizeWeixinGzhPublishErrorMessage,
} from "../../shared/publisher-errors";
import {
fetchImageAssetBlob,
getCenteredCropRect,
@@ -1932,10 +1936,10 @@ function failureResult(error: unknown): ReturnType<PublishAdapter["publish"]> ex
if (message.startsWith("weixin_gzh_public_url_missing")) {
return {
status: "failed",
summary: "微信公众号已提交发布,但未能获取外部文章链接,请在公众号后台发表记录确认。",
summary: WEIXIN_GZH_PUBLIC_URL_MISSING_MESSAGE,
error: {
code: "weixin_gzh_public_url_missing",
message,
message: normalizeWeixinGzhPublishErrorMessage(message) ?? WEIXIN_GZH_PUBLIC_URL_MISSING_MESSAGE,
},
};
}