{"record":{"id":"f3a24e92dd843527","repo":"DIYgod/RSSHub","slug":"invalid-type-f3a24e","errorCode":null,"errorMessage":"invalid type","messagePattern":"invalid type","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"warning","filePath":"lib/routes/njust/cwc.ts","lineNumber":42,"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| tzgg     | bslc     |`,\n};\n\nasync function handler(ctx) {\n    const type = ctx.req.param('type') ?? 'tzgg';\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 = $('ul.news_list').find('li');\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('span.news_meta').text(), 'YYYY-MM-DD'), 8),\n            link: $(item).find('a').attr('href'),\n        })),\n    };\n}","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/njust/cwc.ts#L24-L60","documentation":"InvalidParameterError from the NJUST CWC (财务处) route. Same Map-lookup pattern as 412. Valid type keys are tzgg / bslc.","triggerScenarios":"Calling /njust/cwc/:type with a value not in the CWC map — typos or codes borrowed from another NJUST route.","commonSituations":"User assumes codes are uniform across NJUST routes; typo; outdated docs.","solutions":["Use one of tzgg (通知公告) or bslc (办事流程) for this route.","Refer to the route description table for valid codes.","Remember each njust/* route has its own map."],"exampleFix":"// before\nconst info = map.get(type);\nif (!info) {\n    throw new InvalidParameterError('invalid type');\n}\n\n// after — caller: GET /njust/cwc/tzgg or /njust/cwc/bslc","handlingStrategy":"validation","validationCode":"const VALID = new Set(['tzgg','bslc']);\nfunction buildNjustCwcUrl(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 isCwcType = (t: string): t is 'tzgg'|'bslc' => VALID.has(t);","tryCatchPattern":null,"preventionTips":["Use only tzgg / bslc for the CWC route.","Treat each njust/* route's code set as independent.","Validate before requesting to avoid a 400 round-trip."],"tags":["validation","route-parameter","user-input","njust"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}