{"record":{"id":"26a78f5802b28101","repo":"DIYgod/RSSHub","slug":"no-category-category","errorCode":null,"errorMessage":"No category '${category}'.","messagePattern":"No category '(.+?)'\\.","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"warning","filePath":"lib/routes/finviz/news.ts","lineNumber":53,"sourceCode":"        {\n            source: ['finviz.com/news.ashx', 'finviz.com/'],\n        },\n    ],\n    name: 'News',\n    maintainers: ['nczitzk'],\n    handler,\n    url: 'finviz.com/news.ashx',\n    description: `| News | Blogs |\n| ---- | ----- |\n| news | blogs |`,\n};\n\nasync function handler(ctx) {\n    const { category = 'News' } = ctx.req.param();\n    const limit = ctx.req.query('limit') ? Number(ctx.req.query('limit')) : 200;\n\n    if (!Object.hasOwn(categories, category.toLowerCase())) {\n        throw new InvalidParameterError(`No category '${category}'.`);\n    }\n\n    const rootUrl = 'https://finviz.com';\n    const currentUrl = new URL('news.ashx', rootUrl).href;\n\n    const { data: response } = await got(currentUrl);\n\n    const $ = load(response);\n\n    const items = $('table.table-fixed')\n        .eq(categories[category.toLowerCase()])\n        .find('tr')\n        .slice(0, limit)\n        .toArray()\n        .map((item) => {\n            const $item = $(item);\n\n            const a = $item.find('a.nn-tab-link');","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/finviz/news.ts#L35-L71","documentation":"Thrown as an `InvalidParameterError` when the `category` path parameter (case-insensitive) is not a key in the `categories` object `{news: 0, blogs: 1}`. The check uses `Object.hasOwn(categories, category.toLowerCase())`. The default is `'News'`. This is pre-flight validation before fetching finviz.com/news.ashx.","triggerScenarios":"A user requests `/finviz/<category>` where `<category>` is not `news` or `blogs` (case-insensitive) — e.g., `/finviz/stocks`, `/finviz/forex`, or `/finviz/articles`. The hasOwn check fails immediately.","commonSituations":"User assumes Finviz has more categories than it does. User passes a Finviz page name from a different part of the site (e.g., `screener`, `insider`). The user includes uppercase characters which are handled by toLowerCase() but the underlying value is still invalid.","solutions":["Use `news` or `blogs` as the category (case-insensitive).","Omit the category parameter to default to `News`.","Check the route description table for the valid options."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const categories = { news: 0, blogs: 1 };\n\nfunction validateCategory(category: string | undefined): string {\n    const resolved = (category ?? 'news').toLowerCase();\n    if (!Object.hasOwn(categories, resolved)) {\n        throw new InvalidParameterError(`No category '${category}'. Valid: news, blogs`);\n    }\n    return resolved;\n}","typeGuard":"function isFinvizCategory(category: string): boolean {\n    return Object.hasOwn({ news: 0, blogs: 1 }, category.toLowerCase());\n}","tryCatchPattern":null,"preventionTips":["Use only 'news' or 'blogs' as the category (case-insensitive).","Omit the category to default to 'News'.","Check the route description table for valid options."],"tags":["parameter-validation","enum-check","invalid-parameter-error","finviz"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}