{"record":{"id":"a131ae6cce07068a","repo":"DIYgod/RSSHub","slug":"response-return-msg","errorCode":null,"errorMessage":"${response.return_msg}","messagePattern":"\\$\\{response\\.return_msg\\}","errorType":"exception","errorClass":"Error","httpStatus":503,"severity":"error","filePath":"lib/routes/niaogebiji/index.ts","lineNumber":29,"sourceCode":"    example: '/niaogebiji',\n    radar: [\n        {\n            source: ['niaogebiji.com/', 'niaogebiji.com/bulletin'],\n            target: '',\n        },\n    ],\n    name: '首页',\n    maintainers: ['WenryXu'],\n    handler,\n    url: 'niaogebiji.com/',\n};\n\nasync function handler() {\n    const baseUrl = 'https://www.niaogebiji.com';\n    const { data: response } = await got(`${baseUrl}/pc/index/getMoreArticle`);\n\n    if (response.return_code !== '200') {\n        throw new Error(response.return_msg);\n    }\n\n    const postList = response.return_data.map((item) => ({\n        title: item.title,\n        description: item.summary,\n        author: item.author,\n        pubDate: parseDate(item.published_at, 'X'),\n        updated: parseDate(item.updated_at, 'X'),\n        category: [item.catname, ...item.tag_list],\n        link: new URL(item.link, baseUrl).href,\n    }));\n\n    const result = await Promise.all(\n        postList.map((item) =>\n            cache.tryGet(item.link, async () => {\n                const { data: response } = await got(item.link);\n                const $ = load(response);\n","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/niaogebiji/index.ts#L11-L47","documentation":"Thrown by the niaogebiji home route after calling /pc/index/getMoreArticle. The endpoint returns a JSON envelope with return_code; anything other than '200' is treated as a failure and the server's return_msg is re-thrown as a plain Error. This surfaces upstream API errors (rate limiting, maintenance, schema drift) directly to the feed consumer.","triggerScenarios":"niaogebiji.com's getMoreArticle endpoint returns return_code !== '200' — e.g. rate limiting (429-style), server maintenance, a changed response contract, or an internal error on their side. The thrown message is whatever the server put in return_msg.","commonSituations":"Polling the feed too frequently triggers the site's rate limit; the site is under maintenance; the API contract changed and return_code is now numeric 200 vs string '200'; transient backend errors.","solutions":["Read the return_msg value in the error — it usually states the actual cause (rate limit, maintenance, etc.).","If rate-limited, increase the polling interval / cache TTL on the RSSHub route.","If return_msg indicates a contract change, verify the endpoint manually with curl and update the code field check.","Retry after a short backoff for transient upstream failures."],"exampleFix":"// before\nif (response.return_code !== '200') {\n    throw new Error(response.return_msg);\n}\n\n// after — include context for debugging\nif (response.return_code !== '200') {\n    throw new Error(`niaogebiji API error (${response.return_code}): ${response.return_msg ?? 'unknown'}`);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"const isEnvelopeOk = (r: any): boolean =>\n  r && typeof r === 'object' && r.return_code === '200' && Array.isArray(r.return_data);","tryCatchPattern":"try {\n  const { data } = await got('https://www.niaogebiji.com/pc/index/getMoreArticle');\n  if (data.return_code !== '200') throw new Error(`API ${data.return_code}: ${data.return_msg}`);\n  // ...process data.return_data\n} catch (e) {\n  // rate-limited or maintenance — back off and retry with exponential delay\n}","preventionTips":["Cache the response and set a respectful polling interval to avoid rate limits.","Log return_msg verbatim — it carries the upstream reason.","Watch for envelope shape changes (return_code numeric vs string)."],"tags":["api","upstream","rate-limit","niaogebiji"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}