{"record":{"id":"1993828b9edd18dd","repo":"DIYgod/RSSHub","slug":"invalid-type-199382","errorCode":null,"errorMessage":"invalid type","messagePattern":"invalid type","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"warning","filePath":"lib/routes/njust/jwc.ts","lineNumber":44,"sourceCode":"        requirePuppeteer: true,\n        antiCrawler: false,\n        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n    },\n    name: '教务处',\n    maintainers: ['MilkShakeYoung', 'jasongzy'],\n    handler,\n    description: `| 教师通知 | 学生通知 | 新闻 | 学院动态 |\n| -------- | -------- | ---- | -------- |\n| jstz     | xstz     | xw   | xydt     |`,\n};\n\nasync function handler(ctx) {\n    const type = ctx.req.param('type') ?? 'xstz';\n    const info = map.get(type);\n    if (!info) {\n        throw new InvalidParameterError('invalid type');\n    }\n    const id = info.id;\n    const siteUrl = host + id + '/list.htm';\n\n    const html = await getContent(siteUrl, true);\n    const $ = load(html);\n    const list = $('div#wp_news_w3').find('tr');\n\n    return {\n        title: info.title,\n        link: siteUrl,\n        item: list.toArray().map((item) => ({\n            title: $(item).find('a').attr('title')!.trim(),\n            pubDate: timezone(parseDate($(item).find('td[width=\"14%\"]').text(), 'YYYY-MM-DD'), 8),\n            link: $(item).find('a').attr('href'),\n        })),\n    };\n}","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/njust/jwc.ts#L26-L62","documentation":"InvalidParameterError from the NJUST 教务处 (JWC) route. Same Map-lookup pattern, default type is 'xstz'. Valid keys are jstz / xstz / xw / xydt.","triggerScenarios":"Calling /njust/jwc/:type with a value not in the JWC map — typo, or a code from another NJUST route (e.g. 'tzgg' which is valid on cwc/eoe but not here).","commonSituations":"Cross-route code confusion (tzgg vs tzgg-style names differ); typo; outdated docs.","solutions":["Use one of jstz (教师通知), xstz (学生通知), xw (新闻), xydt (学院动态).","Refer to the route description table for the authoritative set.","Do not reuse codes from other njust/* routes without checking."],"exampleFix":"// before\nconst info = map.get(type);\nif (!info) {\n    throw new InvalidParameterError('invalid type');\n}\n\n// after — caller: GET /njust/jwc/jstz | xstz | xw | xydt","handlingStrategy":"validation","validationCode":"const VALID = new Set(['jstz','xstz','xw','xydt']);\nfunction buildNjustJwcUrl(type) {\n  if (!VALID.has(type)) throw new Error(`invalid type '${type}'. Valid: ${[...VALID].join(', ')}`);\n  return host + MAP[type] + '/list.htm';\n}","typeGuard":"const isJwcType = (t: string): t is 'jstz'|'xstz'|'xw'|'xydt' => VALID.has(t);","tryCatchPattern":null,"preventionTips":["Use only jstz / xstz / xw / xydt for the NJUST JWC route.","Note 'tzgg' (valid on cwc/eoe) is NOT valid here.","Validate client-side against this route's table."],"tags":["validation","route-parameter","user-input","njust"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}