{"record":{"id":"026bbb1ef8f9c676","repo":"DIYgod/RSSHub","slug":"article-api-error-026bbb","errorCode":null,"errorMessage":"article api error","messagePattern":"article api error","errorType":"exception","errorClass":"Error","httpStatus":503,"severity":"error","filePath":"lib/routes/scut/jwc/school.ts","lineNumber":41,"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/school/:category?',\n    categories: ['university'],\n    example: '/scut/jwc/school/all',\n    parameters: { category: '通知分类，默认为 `all`' },\n    features: {\n        requireConfig: false,\n        requirePuppeteer: false,\n        antiCrawler: false,\n        supportBT: false,\n        supportPodcast: false,","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/scut/jwc/school.ts#L23-L59","documentation":"Same `apiSuccessAssert` pattern in the SCUT JWC school-level notice route. Throws `'article api error'` when `data.success` is falsy for any article detail call.","triggerScenarios":"A school notice id in the fetched list returns `success: false` from the detail API (revoked notice, archived, backend error).","commonSituations":"Notice revoked between list and detail fetch; upstream API schema or auth change; intermittent backend failure.","solutions":["Retry the feed after a brief wait.","Examine the detail API response directly to determine if the schema changed or the id is genuinely invalid.","Modify the handler to skip failing items instead of aborting the entire feed."],"exampleFix":"// before\nconst apiSuccessAssert = (data) => {\n    if (!data.success) {\n        throw new Error('article api error');\n    }\n};\n\n// after\nconst apiSuccessAssert = (data) => {\n    if (!data.success) {\n        console.warn('article api returned success=false for id', data.id);\n    }\n};","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":["Tolerate individual article failures so one revoked notice does not break the feed.","Retry transient failures with backoff.","Watch for schema drift in the upstream success flag."],"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"}