{"record":{"id":"2fee53a20be1b6bf","repo":"DIYgod/RSSHub","slug":"response-statusmessage-2fee53","errorCode":null,"errorMessage":"response.statusMessage","messagePattern":"response\\.statusMessage","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/routes/gov/taiyuan/rsj.ts","lineNumber":48,"sourceCode":"    handler,\n    url: 'rsj.taiyuan.gov.cn/*',\n    description: `| 工作动态 | 太原新闻 | 通知公告 | 县区动态 | 国内动态 | 图片新闻 |\n| -------- | -------- | -------- | -------- | -------- | -------- |\n| gzdt     | tyxw     | gggs     | xqdt     | gndt     | tpxw     |`,\n};\n\nasync function handler(ctx) {\n    const categoryID = ctx.req.param('caty');\n    const page = ctx.req.param('page') ?? '1';\n\n    const pageParam = Number.parseInt(page) > 1 ? `_${page}` : '';\n    const pagePath = `/zfxxgk/${categoryID}/index${pageParam}.shtml`;\n\n    const currentURL = new URL(pagePath, rootURL);\n    const response = await got(currentURL.href);\n\n    if (response.statusCode !== 200) {\n        throw new Error(response.statusMessage);\n    }\n\n    const $ = load(response.data, { decodeEntities: false } as CheerioOptions);\n    const title = $('.tit').find('a:eq(2)').text();\n    const list = $('.RightSide_con ul li')\n        .toArray()\n        .map((item) => {\n            const link = $(item).find('a');\n            const date = $(item).find('span.fr');\n            return {\n                title: link.attr('title')!,\n                link: link.attr('href'),\n                pubDate: timezone(parseDate(date.text(), 'YYYY-MM-DD'), 8),\n            };\n        });\n\n    return {\n        title: '太原市人力资源和社会保障局 - ' + title,","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/gov/taiyuan/rsj.ts#L30-L66","documentation":"Thrown by the Taiyuan Human Resources bureau route when the upstream HTTP response from `rsj.taiyuan.gov.cn` has a non-200 status. The handler throws `response.statusMessage` as a plain `Error`. Like the zzb route, `statusMessage` may be empty for some status codes, yielding an unhelpful error.","triggerScenarios":"The upstream site returns non-200 for the constructed URL `/zfxxgk/<caty>/index[_page].shtml`. The `caty` parameter is free-form and the page number is unbounded.","commonSituations":"Wrong category slug that does not correspond to a real directory, requesting a page beyond available pages, upstream maintenance, or the site blocking the RSSHub user-agent.","solutions":["Verify `http://rsj.taiyuan.gov.cn/zfxxgk/<caty>/index.shtml` loads in a browser.","Use one of the documented categories: `gzdt`, `tyxw`, `gggs`, `xqdt`, `gndt`, `tpxw`.","Retry later if the upstream is temporarily unavailable.","Maintainer fix: include the URL and status code in the thrown error for diagnostics."],"exampleFix":"// before\nif (response.statusCode !== 200) {\n    throw new Error(response.statusMessage);\n}\n\n// after\nif (response.statusCode !== 200) {\n    throw new Error(`rsj.taiyuan.gov.cn returned ${response.statusCode} for ${currentURL.href}`);\n}","handlingStrategy":"try-catch","validationCode":"const VALID_CATEGORIES = ['gzdt', 'tyxw', 'gggs', 'xqdt', 'gndt', 'tpxw'] as const;\nfunction isValidCategory(caty: string): boolean {\n    return (VALID_CATEGORIES as readonly string[]).includes(caty);\n}\n// Validate before the HTTP request to avoid confusing upstream errors.","typeGuard":"function isValidRsjCategory(caty: string): caty is typeof VALID_CATEGORIES[number] {\n    return (VALID_CATEGORIES as readonly string[]).includes(caty);\n}","tryCatchPattern":"try {\n    const response = await got(currentURL.href);\n    if (response.statusCode !== 200) {\n        throw new Error(`rsj.taiyuan.gov.cn returned ${response.statusCode} for ${currentURL.href}`);\n    }\n} catch (err) {\n    throw new Error(`Failed to fetch from rsj.taiyuan.gov.cn: ${err instanceof Error ? err.message : String(err)}`);\n}","preventionTips":["Pre-validate the category slug against the known set before making the HTTP request.","Include the URL and status code in thrown errors.","Cache successful responses to reduce upstream load."],"tags":["network","upstream","http-status","government"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}