{"record":{"id":"f632a5e6c9162cf8","repo":"DIYgod/RSSHub","slug":"article-api-error-f632a5","errorCode":null,"errorMessage":"article api error","messagePattern":"article api error","errorType":"exception","errorClass":"Error","httpStatus":503,"severity":"error","filePath":"lib/routes/scut/jwc/notice.ts","lineNumber":44,"sourceCode":"};\n\nconst generateArticlePubDate = (createDateStr) => {\n    const date = new Date(createDateStr);\n    date.setHours(8);\n    date.setMinutes(0);\n    date.setSeconds(0);\n    date.setMilliseconds(0);\n\n    return timezone(date, 8);\n};\n\nconst isRedirectPage = (data) => !!data.link;\n\nconst resolveRelativeUrl = (html) => html.replaceAll('src=\"/', () => `src=\"${new URL('.', baseUrl).href}`).replaceAll('href=\"/', () => `href=\"${new URL('.', baseUrl).href}`);\n\nconst apiSuccessAssert = (data) => {\n    if (!data.success) {\n        throw new Error('article api error');\n    }\n};\n\nconst generateArticleLink = (id) => `<p>链接：<a href=\"${getArticleUrlById(id)}\">电脑版</a>&nbsp;|&nbsp;<a href=\"${getArticleMobileUrlById(id)}\">手机版</a></p>`;\n\nconst generateArticleFullText = (data) => resolveRelativeUrl(data.content) + generateArticleLink(data.id);\n\nexport const route: Route = {\n    path: '/jwc/notice/:category?',\n    categories: ['university'],\n    example: '/scut/jwc/notice/all',\n    parameters: { category: '通知分类，默认为 `all`' },\n    features: {\n        requireConfig: false,\n        requirePuppeteer: false,\n        antiCrawler: false,\n        supportBT: false,\n        supportPodcast: false,","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/scut/jwc/notice.ts#L26-L62","documentation":"Same `apiSuccessAssert` helper as news.ts, used by the SCUT JWC notice route. Throws `'article api error'` when an article detail API responds with `success: false`. A single failing article aborts the entire feed generation.","triggerScenarios":"Fetching notices for a category where one or more detail calls return `success: false` (deleted notice, permission-restricted, backend hiccup).","commonSituations":"Category contains a stale id pointing to a removed notice; SCUT backend in maintenance; rate limiting after a burst of detail requests.","solutions":["Retry shortly — transient backend issues resolve themselves.","Inspect the raw detail API response for the failing id to confirm whether `success` is genuinely false or the schema shifted.","Patch the handler to tolerate `success: false` by filtering out the affected item rather than throwing."],"exampleFix":"// before\nif (!data.success) {\n    throw new Error('article api error');\n}\n\n// after\nif (!data.success) {\n    return null;\n}\n// then filter nulls out of the items array","handlingStrategy":"try-catch","validationCode":"const data = await fetchArticle(id);\nif (!data?.success) return null;","typeGuard":"const isArticleSuccess = (d: unknown): boolean => Boolean((d as any)?.success);","tryCatchPattern":"try { apiSuccessAssert(data); } catch (e) {\n    if (e instanceof Error && e.message === 'article api error') continue;\n    throw e;\n}","preventionTips":["Filter out items whose detail returns success=false instead of aborting the feed.","Cache list results to reduce repeated upstream calls.","Log skipped ids for later inspection."],"tags":["upstream-api","data-integrity","university"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}