{"record":{"id":"d26637261f5b049d","repo":"DIYgod/RSSHub","slug":"bad-category-see-a-href-https-docs-rsshub-app-d26637","errorCode":null,"errorMessage":"Bad category. See <a href=\"https://docs.rsshub.app/routes/government#guang-dong-sheng-ren-min-zheng-fu-guang-dong-sheng-jiao-yu-kao-shi-yuan\">docs</a>","messagePattern":"Bad category\\. See <a href=\"https://docs\\.rsshub\\.app/routes/government#guang-dong-sheng-ren-min-zheng-fu-guang-dong-sheng-jiao-yu-kao-shi-yuan\">docs</a>","errorType":"exception","errorClass":null,"httpStatus":503,"severity":"warning","filePath":"lib/routes-deprecated/gov/guangdong/eea.js","lineNumber":22,"sourceCode":"const timezone = require('@/utils/timezone');\nconst { parseDate } = require('@/utils/parse-date');\nconst rootUrl = 'http://eea.gd.gov.cn/';\n\nconst config = {\n    kszs: { link: '/bmbk/kszs/', title: '考试招生' },\n    shks: { link: '/shks/', title: '社会考试' },\n    zkgs: { link: '/zwgk_zkgs/', title: '招考公示' },\n    bkzn: { link: '/bmbk/bkzn/', title: '报考指南' },\n    ywdt: { link: '/news/', title: '要闻动态' },\n    gkzl: { link: '/zwgk/gkzl/', title: '公开专栏' },\n    zcwj: { link: '/zwgk/zwwj/', title: '政策文件' },\n    zcjd: { link: '/zcjd/', title: '政策解读' },\n};\n\nmodule.exports = async (ctx) => {\n    const cfg = config[ctx.params.caty];\n    if (!cfg) {\n        throw new Error('Bad category. See <a href=\"https://docs.rsshub.app/routes/government#guang-dong-sheng-ren-min-zheng-fu-guang-dong-sheng-jiao-yu-kao-shi-yuan\">docs</a>');\n    }\n\n    const currentUrl = url.resolve(rootUrl, cfg.link);\n    const response = await got({ method: 'get', url: currentUrl });\n\n    const $ = cheerio.load(response.data);\n    const list = $('div.main>div.content>ul>li')\n        .map((_, item) => {\n            item = $(item).find('a');\n            return {\n                title: item.text(),\n                link: item.attr('href'),\n            };\n        })\n        .get();\n\n    const items = await Promise.all(\n        list.map((item) =>","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes-deprecated/gov/guangdong/eea.js#L4-L40","documentation":"Thrown by the Guangdong Education Examinations Authority route (deprecated) when :caty is missing from the config map. Accepted keys: shks, zkgs, bkzn, ywdt, gkzl, zcwj, zcjd. config[ctx.params.caty] returns undefined → throw before fetch.","triggerScenarios":"Request with a slug outside the seven valid keys, e.g. /gov/guangdong/eea/<unknown>.","commonSituations":"Slug typo; confusing this authority's slugs with the Education Department's (edu.js) slugs which look similar but differ.","solutions":["Use one of shks, zkgs, bkzn, ywdt, gkzl, zcwj, zcjd.","Confirm against the config map at the top of lib/routes-deprecated/gov/guangdong/eea.js.","Avoid mixing slugs between eea.js and edu.js — they are different sites."],"exampleFix":"// before\nGET /gov/guangdong/eea/zwwj   // typo (config has zcwj)\n// after\nGET /gov/guangdong/eea/zcwj    // 政策文件","handlingStrategy":"validation","validationCode":"const VALID = ['shks', 'zkgs', 'bkzn', 'ywdt', 'gkzl', 'zcwj', 'zcjd'];\nif (!VALID.includes(ctx.params.caty)) throw new Error(`Invalid caty. Valid: ${VALID.join(', ')}`);","typeGuard":"type EeaCaty = 'shks' | 'zkgs' | 'bkzn' | 'ywdt' | 'gkzl' | 'zcwj' | 'zcjd';\nconst isEeaCaty = (v: string): v is EeaCaty => (['shks','zkgs','bkzn','ywdt','gkzl','zcwj','zcjd'] as string[]).includes(v);","tryCatchPattern":"try { await fetch(route); }\ncatch (e) { if (/Bad category/.test(e.message)) showValidList(); else throw e; }","preventionTips":["Distinguish eea (考试院) slugs from edu (教育厅) slugs.","Keep the seven-key allowlist in sync with config."],"tags":["rsshub","parameter-validation","deprecated-route","government"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}