DIYgod/RSSHub · error · Error

response.statusMessage

Error message

response.statusMessage

What it means

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.

Source

Thrown at lib/routes/gov/shenzhen/hrss/szksy/index.ts:47

    maintainers: ['zlasd'],
    handler,
    url: 'hrss.sz.gov.cn/*',
    description: `| 通知公告 | 报名信息 | 成绩信息 | 合格标准 | 合格人员公示 | 证书发放信息 |
| :------: | :------: | :------: | :------: | :----------: | :----------: |
|   tzgg   |   bmxx   |   cjxx   |   hgbz   |    hgrygs    |     zsff     |`,
};

async function handler(ctx) {
    const categoryID = ctx.req.param('caty');
    const page = ctx.req.param('page') ?? '1';

    const pageParam = Number.parseInt(page) > 1 ? `_${page}` : '';
    const pagePath = `/szksy/zwgk/${categoryID}/index${pageParam}.html`;

    const currentURL = new URL(pagePath, rootURL); // do not use deprecated 'url.resolve'
    const response = await got({ method: 'get', url: currentURL });
    if (response.statusCode !== 200) {
        throw new Error(response.statusMessage);
    }

    const $ = load(response.data);
    const title = $('.zx_rm_tit span').text().trim();
    const list = $('.zx_ml_list ul li')
        .slice(1)
        .toArray()
        .map((item) => {
            const tag = $(item).find('div.list_name a');
            const tag2 = $(item).find('span:eq(1)');
            return {
                title: tag.text().trim(),
                link: tag.attr('href'),
                pubDate: timezone(parseDate(tag2.text(), 'YYYY/MM/DD'), 0),
            };
        });

    return {

View on GitHub (pinned to bed535e087)

Solutions

  1. Verify the category ID is valid: tzgg, bmxx, cjxx, hgbz, hgrygs, or zsff
  2. If specifying a page number, ensure it exists (start with page 1 and increment)
  3. Retry after a few minutes if the site is temporarily unavailable (503)
  4. Check the URL directly in a browser to confirm the page exists

Example fix

// before
if (response.statusCode !== 200) {
    throw new Error(response.statusMessage);
}

// after (include URL and status code for better diagnostics)
if (response.statusCode !== 200) {
    throw new Error(`Request to ${currentURL.href} failed with HTTP ${response.statusCode}: ${response.statusMessage}`);
}
Defensive patterns

Strategy: try-catch

Validate before calling

const VALID_CATEGORY_IDS = ['tzgg', 'bmxx', 'cjxx', 'hgbz', 'hgrygs', 'zsff'];
const categoryID = ctx.req.param('caty');
if (!VALID_CATEGORY_IDS.includes(categoryID)) {
    throw new InvalidParameterError(`Invalid category '${categoryID}'. Valid: ${VALID_CATEGORY_IDS.join(', ')}`);
}

Try / catch

try {
    const response = await got({ method: 'get', url: currentURL });
    if (response.statusCode !== 200) {
        throw new Error(`HTTP ${response.statusCode} (${response.statusMessage}) for ${currentURL.href}`);
    }
    // process response
} catch (e) {
    if (e.response?.statusCode === 404) {
        throw new InvalidParameterError(`Page not found. Check category and page number.`);
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/3ac5750e79172466. Report an issue: GitHub.