{"record":{"id":"56643204344c9a63","repo":"DIYgod/RSSHub","slug":"response-statusmessage-566432","errorCode":null,"errorMessage":"response.statusMessage","messagePattern":"response\\.statusMessage","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/routes/gov/shenzhen/zzb/index.ts","lineNumber":47,"sourceCode":"    maintainers: ['zlasd'],\n    handler,\n    url: 'zzb.sz.gov.cn/*',\n    description: `| 通知公告 | 任前公示 | 政策法规 | 工作动态 | 部门预算决算公开 | 业务表格下载 |\n| :------: | :------: | :------: | :------: | :--------------: | :----------: |\n|   tzgg   |   rqgs   |   zcfg   |   gzdt   |       xcbd       |     bgxz     |`,\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 = `/${categoryID}/index${pageParam}.html`;\n\n    const currentURL = new URL(pagePath, rootURL); // do not use deprecated 'url.resolve'\n    const response = await got({ method: 'get', url: currentURL });\n    if (response.statusCode !== 200) {\n        throw new Error(response.statusMessage);\n    }\n\n    const $ = load(response.data);\n    const title = $('#Title').text().trim();\n    const list = $('#List tbody tr td table tbody tr td[width=\"96%\"]')\n        .toArray()\n        .map((item) => {\n            const tag = $(item).find('font a');\n            const tag2 = $(item).find('font[size=\"2px\"]');\n            return {\n                title: tag.text(),\n                link: tag.attr('href'),\n                pubDate: timezone(parseDate(tag2.text().trim(), 'YYYY/MM/DD'), 0),\n            };\n        });\n\n    return {\n        title: '深圳组工在线 - ' + title,","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/gov/shenzhen/zzb/index.ts#L29-L65","documentation":"Thrown by the Shenzhen Organization Department (zzb) route when the upstream HTTP response from `www.zzb.sz.gov.cn` has a status code other than 200. The handler re-throws `response.statusMessage` directly as a plain `Error`. The `statusMessage` property on Node HTTP responses can be undefined or an empty string for certain status codes (e.g. some proxies and CDNs omit it), producing an error with no useful text.","triggerScenarios":"The upstream government site returns 404 (bad category/page path), 500/502/503 (server error or maintenance), or the constructed URL `/[caty]/index[_page].html` does not resolve. The page parameter is user-supplied and unbounded.","commonSituations":"Upstream site maintenance windows, requesting a page number beyond the available pages (e.g. `/gov/shenzhen/zzb/tzgg/999`), DNS/network issues, or anti-crawler blocks returning non-200 status codes.","solutions":["Open `http://www.zzb.sz.gov.cn/<caty>/index.html` in a browser to verify the page exists and the site is up.","Ensure the page number is within range (start with page 1 or omit it).","Retry later if the upstream is in maintenance.","As a maintainer fix: replace `throw new Error(response.statusMessage)` with a descriptive message including the URL and status code, and fall back to a generic string when `statusMessage` is empty."],"exampleFix":"// before\nif (response.statusCode !== 200) {\n    throw new Error(response.statusMessage);\n}\n\n// after\nif (response.statusCode !== 200) {\n    throw new Error(`Upstream zzb.sz.gov.cn returned ${response.statusCode} ${response.statusMessage || ''} for ${currentURL.href}`.trim());\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"let response;\ntry {\n    response = await got({ method: 'get', url: currentURL });\n} catch (err) {\n    throw new Error(`Failed to reach zzb.sz.gov.cn: ${err instanceof Error ? err.message : String(err)}`);\n}\nif (response.statusCode !== 200) {\n    throw new Error(`zzb.sz.gov.cn returned HTTP ${response.statusCode} for ${currentURL.href}`);\n}","preventionTips":["Monitor the upstream site for scheduled maintenance announcements.","Cache successful responses so transient failures don't propagate.","Include the URL and status code in error messages for faster diagnosis.","Bound the `:page` parameter to a reasonable maximum to avoid 404s on non-existent pages."],"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"}