{"record":{"id":"2ddf707fdfed721d","repo":"DIYgod/RSSHub","slug":"wechat-mp-params-join","errorCode":null,"errorMessage":"wechat-mp: ${params.join(': ')}","messagePattern":"wechat-mp: (.+?)","errorType":"exception","errorClass":"WeChatMpError","httpStatus":null,"severity":"error","filePath":"lib/utils/wechat-mp.ts","lineNumber":58,"sourceCode":"        this.name = 'WeChatMpError';\n    }\n}\n\nconst MAINTAINERS = ['@Rongronggg9'];\n\nconst formatLogNoMention = (...params: string[]): string => `wechat-mp: ${params.join(': ')}`;\nconst formatLog = (...params: string[]): string => `${formatLogNoMention(...params)}\nConsider raise an issue (mentioning ${MAINTAINERS.join(', ')}) with the article URL for further investigation`;\nlet warn = (...params: string[]) => logger.warn(formatLog(...params));\nconst error = (...params: string[]): never => {\n    const msg = formatLog(...params);\n    logger.error(msg);\n    throw new WeChatMpError(msg);\n};\nconst errorNoMention = (...params: string[]): never => {\n    const msg = formatLogNoMention(...params);\n    logger.error(msg);\n    throw new WeChatMpError(msg);\n};\nconst toggleWerror = (() => {\n    const onFunc = (...params: string[]) => error('WarningAsError', ...params);\n    const offFunc = warn;\n    return (on: boolean) => {\n        warn = on ? onFunc : offFunc;\n    };\n})();\n\nconst replaceReturnNewline = (() => {\n    const returnRegExp = /\\r|\\\\(r|x0d)/g;\n    const newlineRegExp = /\\n|\\\\(n|x0a)/g;\n    return (text: string, replaceReturnWith = '', replaceNewlineWith = '<br>') => text.replaceAll(returnRegExp, () => replaceReturnWith).replaceAll(newlineRegExp, () => replaceNewlineWith);\n})();\nconst fixUrl = (() => {\n    const ampRegExp = /(&|\\\\x26)amp;/g;\n    return (text: string) => text.replaceAll(ampRegExp, '&');\n})();","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/utils/wechat-mp.ts#L40-L76","documentation":"wechat-mp.ts's errorNoMention helper throws a WeChatMpError whose message is built by formatLogNoMention - the 'wechat-mp: ...' prefix without the maintainer-mention suffix. It is used for failures that are the user's fault (bad URL, missing param) rather than upstream-page-change issues worth a GitHub issue.","triggerScenarios":"A caller invokes errorNoMention(...) for a self-contained failure such as an invalid article URL, a missing required parameter, or a network-level rejection that should not prompt the user to file an issue.","commonSituations":"Passing a malformed or non-weixin.qq.com URL to a wechat-mp route; missing required query parameters; regional blocking returning a non-200 status that the route treats as a user-side error.","solutions":["Validate the article URL is a valid mp.weixin.qq.com link before calling the route.","Provide all required parameters documented for the route.","If the failure is actually an upstream change, the route should be using error() (with mention) instead - report it."],"exampleFix":"// before\nerrorNoMention('invalid url', url);\n// after\nif (!/^https:\\/\\/mp\\.weixin\\.qq\\.com\\/.+/.test(url)) {\n    throw new InvalidParameterError('Expected a mp.weixin.qq.com article URL');\n}","handlingStrategy":"validation","validationCode":"function isValidWeChatMpUrl(url: string): boolean {\n  return /^https?:\\/\\/mp\\.weixin\\.qq\\.com\\/s[/?#]/.test(url);\n}\nif (!isValidWeChatMpUrl(url)) throw new InvalidParameterError('Expected mp.weixin.qq.com article URL');","typeGuard":"const isWeChatMpArticleUrl = (u: unknown): u is string =>\n  typeof u === 'string' && /^https?:\\/\\/mp\\.weixin\\.qq\\.com\\/s[/?#]/.test(u);","tryCatchPattern":"try {\n  return await parseWeChatMp(url);\n} catch (e) {\n  if (e instanceof WeChatMpError && !/Consider raise an issue/.test(e.message)) {\n    return ctx.throw(400, e.message); // user-side error -> 400\n  }\n  throw e;\n}","preventionTips":["Validate the article URL shape before invoking the route.","Distinguish WeChatMpError variants by the 'Consider raise an issue' suffix: present => upstream issue, absent => user error.","Surface errorNoMention failures to the caller as 4xx, not 5xx."],"tags":["wechat-mp","parsing","rss-route","validation"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}