{"record":{"id":"90597d43ff42a5a5","repo":"DIYgod/RSSHub","slug":"code-not-supported","errorCode":null,"errorMessage":"code not supported","messagePattern":"code not supported","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"error","filePath":"lib/routes/swjtu/xg.ts","lineNumber":88,"sourceCode":"        },\n    ],\n    name: '扬华素质网',\n    maintainers: ['mobyw'],\n    handler,\n    url: 'xg.swjtu.edu.cn/web/Home/PushNewsList',\n    description: `栏目列表：\n\n| 通知公告 | 扬华新闻 | 多彩学院 | 学工之家 |\n| -------- | -------- | -------- | -------- |\n| tzgg     | yhxw     | dcxy     | xgzj     |`,\n};\n\nasync function handler(ctx) {\n    const code = ctx.req.param('code') ?? 'tzgg';\n    const pageURL = listURL[code];\n\n    if (!pageURL) {\n        throw new InvalidParameterError('code not supported');\n    }\n\n    const resp = await got({\n        method: 'get',\n        url: pageURL,\n    });\n\n    const $ = load(resp.data);\n    const list = $('div.right-side ul.block-ctxlist li');\n\n    const items = await Promise.all(\n        list.toArray().map((i) => {\n            const item = $(i);\n            return getItem(item, cache);\n        })\n    );\n\n    return {","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/swjtu/xg.ts#L70-L106","documentation":"Thrown by swjtu/xg.ts:88 as an InvalidParameterError when listURL[code] is undefined. listURL (line 10) has exactly four keys: tzgg (通知公告), yhxw (扬华新闻), dcxy (多彩学院), xgzj (学工之家). The code param defaults to 'tzgg' when omitted (line 84), so this only fires when an explicit-but-unrecognized code is supplied.","triggerScenarios":"/swjtu/xg/<code> where code is not one of {tzgg, yhxw, dcxy, xgzj}: typos like 'tzg', wrong case ('TZGG'), or a category code the site has but RSSHub does not map.","commonSituations":"User guesses a category code; the site adds a new column not yet mapped; case mismatch (the keys are lowercase); user passes the Chinese name instead of the code.","solutions":["Use one of the four documented codes, lowercase: tzgg, yhxw, dcxy, xgzj.","Omit the code entirely to get the default (tzgg): GET /swjtu/xg."],"exampleFix":"// before\nGET /swjtu/xg/tzg\n// after\nGET /swjtu/xg/tzgg","handlingStrategy":"validation","validationCode":"const SUPPORTED_CODES = ['tzgg', 'yhxw', 'dcxy', 'xgzj'] as const;\n\nfunction isSupportedCode(code: string): boolean {\n  return (SUPPORTED_CODES as readonly string[]).includes(code);\n}","typeGuard":"const listURL = {\n  tzgg: '...',\n  yhxw: '...',\n  dcxy: '...',\n  xgzj: '...',\n} as const;\n\ntype SwjtuCode = keyof typeof listURL;\n\nfunction isSwjtuCode(code: string): code is SwjtuCode {\n  return Object.hasOwn(listURL, code);\n}","tryCatchPattern":null,"preventionTips":["Omit the code param entirely to get the default (tzgg) when in doubt.","Use lowercase codes only; the keys are case-sensitive.","If the site adds a new column, add it to listURL alongside the URL."],"tags":["invalid-parameter","enum","university","swjtu"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}