{"record":{"id":"2f2925f4dec499ea","repo":"DIYgod/RSSHub","slug":"invalid-type-2f2925","errorCode":null,"errorMessage":"invalid type","messagePattern":"invalid type","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"warning","filePath":"lib/routes/njust/dgxg.ts","lineNumber":43,"sourceCode":"        requirePuppeteer: true,\n        antiCrawler: false,\n        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n    },\n    name: '电光学院研学网',\n    maintainers: ['jasongzy'],\n    handler,\n    description: `| 公示通知 | 学术文化 | 就业指导 |\n| -------- | -------- | -------- |\n| gstz     | xswh     | jyzd     |`,\n};\n\nasync function handler(ctx) {\n    const type = ctx.req.param('type') ?? 'gstz';\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.wp_article_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.Article_PublishDate').text(), 'YYYY-MM-DD'), 8),\n            link: $(item).find('a').attr('href'),\n        })),\n    };\n}","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/njust/dgxg.ts#L25-L61","documentation":"InvalidParameterError from the NJUST 电光学院研学网 (DGXG) route. Same Map-lookup pattern. Valid type keys are gstz / xswh / jyzd.","triggerScenarios":"Calling /njust/dgxg/:type with a value outside the route's map — typo or a code from a sibling route.","commonSituations":"User copies a code from njust/eoe or njust/cs that is not valid here; typo; docs drift.","solutions":["Use one of gstz (公示通知), xswh (学术文化), jyzd (就业指导).","Cross-check against the route description table.","Treat each njust/* route as having an independent code set."],"exampleFix":"// before\nconst info = map.get(type);\nif (!info) {\n    throw new InvalidParameterError('invalid type');\n}\n\n// after — caller: GET /njust/dgxg/gstz | xswh | jyzd","handlingStrategy":"validation","validationCode":"const VALID = new Set(['gstz','xswh','jyzd']);\nfunction buildNjustDgxgUrl(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 isDgxgType = (t: string): t is 'gstz'|'xswh'|'jyzd' => VALID.has(t);","tryCatchPattern":null,"preventionTips":["Use only gstz / xswh / jyzd for the DGXG route.","Cross-check with the route description table.","Validate client-side."],"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"}