{"record":{"id":"13bd88758979ff3f","repo":"DIYgod/RSSHub","slug":"invalid-type-13bd88","errorCode":null,"errorMessage":"invalid type","messagePattern":"invalid type","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":null,"severity":"warning","filePath":"lib/routes/ustc/gs.ts","lineNumber":49,"sourceCode":"        {\n            source: ['gradschool.ustc.edu.cn/'],\n            target: '/gs',\n        },\n    ],\n    name: '研究生院',\n    maintainers: ['jasongzy'],\n    handler,\n    url: 'gradschool.ustc.edu.cn/',\n    description: `| 通知公告 | 新闻动态 |\n| -------- | -------- |\n| tzgg     | xwdt     |`,\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\n    const response = await got(`${host}/column/${id}`);\n    const $ = load(response.data);\n    let items = $('div.r-box > ul')\n        .find('li')\n        .toArray()\n        .map((item): DataItem => {\n            const $item = $(item);\n            const title = $item.find('a').text();\n            const link = $item.find('a').attr('href')!.startsWith('/article') ? host + $item.find('a').attr('href') : $item.find('a').attr('href');\n            const pubDate = timezone(parseDate($item.find('time').text(), 'YYYY-MM-DD'), 8);\n            return {\n                title,\n                pubDate,\n                link,\n            };","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/ustc/gs.ts#L31-L67","documentation":"InvalidParameterError('invalid type') thrown by the USTC 研究生院 (gs) route when ctx.req.param('type') is not in the map (a Map<string, {id,...}>). Supported types: tzgg (通知公告), xwdt (新闻动态); default 'tzgg'.","triggerScenarios":"Requesting /ustc/gs/<type> with a slug other than 'tzgg' or 'xwdt'.","commonSituations":"Slug typo; reused a slug from a different USTC sub-route that does not apply here; stale bookmark.","solutions":["Use 'tzgg' or 'xwdt'.","Omit :type to default to 'tzgg'.","Update saved feed URLs."],"exampleFix":"// before\n// /ustc/gs/news\n// after\n// /ustc/gs/xwdt","handlingStrategy":"type-guard","validationCode":"const GS_TYPES = new Set(['tzgg', 'xwdt']);\nfunction isValidGsType(t: string | undefined): boolean {\n  return t === undefined || GS_TYPES.has(t);\n}","typeGuard":"type GsType = 'tzgg' | 'xwdt';\nfunction isGsType(t: string): t is GsType { return t === 'tzgg' || t === 'xwdt'; }","tryCatchPattern":null,"preventionTips":["Use 'tzgg' or 'xwdt' exactly.","Do not reuse slugs from sibling USTC routes without checking.","Omit :type to default to 'tzgg'."],"tags":["ustc","invalid-parameter","type-enum"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}