{"record":{"id":"3ac5750e79172466","repo":"DIYgod/RSSHub","slug":"response-statusmessage","errorCode":null,"errorMessage":"response.statusMessage","messagePattern":"response\\.statusMessage","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/routes/gov/shenzhen/hrss/szksy/index.ts","lineNumber":47,"sourceCode":"    maintainers: ['zlasd'],\n    handler,\n    url: 'hrss.sz.gov.cn/*',\n    description: `| 通知公告 | 报名信息 | 成绩信息 | 合格标准 | 合格人员公示 | 证书发放信息 |\n| :------: | :------: | :------: | :------: | :----------: | :----------: |\n|   tzgg   |   bmxx   |   cjxx   |   hgbz   |    hgrygs    |     zsff     |`,\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 = `/szksy/zwgk/${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 = $('.zx_rm_tit span').text().trim();\n    const list = $('.zx_ml_list ul li')\n        .slice(1)\n        .toArray()\n        .map((item) => {\n            const tag = $(item).find('div.list_name a');\n            const tag2 = $(item).find('span:eq(1)');\n            return {\n                title: tag.text().trim(),\n                link: tag.attr('href'),\n                pubDate: timezone(parseDate(tag2.text(), 'YYYY/MM/DD'), 0),\n            };\n        });\n\n    return {","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/gov/shenzhen/hrss/szksy/index.ts#L29-L65","documentation":"Thrown by the Shenzhen HRSS exam institute route when the HTTP response status code is not 200. The error message is response.statusMessage (e.g., 'Not Found', 'Internal Server Error', 'Service Unavailable'). This is a generic pass-through of the HTTP status text, meaning the error provides no RSSHub-specific context.","triggerScenarios":"A GET to http://hrss.sz.gov.cn/szksy/zwgk/{caty}/index{_page}.html returns a non-200 status. Common causes: 404 when the category ID is invalid or the page number exceeds available pages; 503 when the server is overloaded; 302 redirect to a maintenance page that got follows to an error.","commonSituations":"Invalid category ID (not one of tzgg, bmxx, cjxx, hgbz, hgrygs, zsff); requesting a page number beyond what exists (e.g., page=99); the Shenzhen HRSS site is down for maintenance; IP-based blocking returning a non-200 status.","solutions":["Verify the category ID is valid: tzgg, bmxx, cjxx, hgbz, hgrygs, or zsff","If specifying a page number, ensure it exists (start with page 1 and increment)","Retry after a few minutes if the site is temporarily unavailable (503)","Check the URL directly in a browser to confirm the page exists"],"exampleFix":"// before\nif (response.statusCode !== 200) {\n    throw new Error(response.statusMessage);\n}\n\n// after (include URL and status code for better diagnostics)\nif (response.statusCode !== 200) {\n    throw new Error(`Request to ${currentURL.href} failed with HTTP ${response.statusCode}: ${response.statusMessage}`);\n}","handlingStrategy":"try-catch","validationCode":"const VALID_CATEGORY_IDS = ['tzgg', 'bmxx', 'cjxx', 'hgbz', 'hgrygs', 'zsff'];\nconst categoryID = ctx.req.param('caty');\nif (!VALID_CATEGORY_IDS.includes(categoryID)) {\n    throw new InvalidParameterError(`Invalid category '${categoryID}'. Valid: ${VALID_CATEGORY_IDS.join(', ')}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n    const response = await got({ method: 'get', url: currentURL });\n    if (response.statusCode !== 200) {\n        throw new Error(`HTTP ${response.statusCode} (${response.statusMessage}) for ${currentURL.href}`);\n    }\n    // process response\n} catch (e) {\n    if (e.response?.statusCode === 404) {\n        throw new InvalidParameterError(`Page not found. Check category and page number.`);\n    }\n    throw e;\n}","preventionTips":["Validate the category ID before making the request","Start with page 1 and verify it exists before incrementing","Implement retry logic for 503 (Service Unavailable)","Check the target URL in a browser first"],"tags":["network","http-status","government","error-message-quality"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}