{"record":{"id":"7e537ac32378ec13","repo":"DIYgod/RSSHub","slug":"category-category-not-found-7e537a","errorCode":null,"errorMessage":"Category \"${category}\" not found","messagePattern":"Category \"(.+?)\" not found","errorType":"exception","errorClass":"Error","httpStatus":503,"severity":"warning","filePath":"lib/routes/thewirehindi/category.ts","lineNumber":63,"sourceCode":"        supportScihub: false,\n    },\n    radar: [\n        {\n            source: ['thewirehindi.com/category/*'],\n        },\n    ],\n    name: 'Category',\n    maintainers: ['Rjnishant530'],\n    handler,\n    url: 'thewirehindi.com/',\n};\n\nasync function handler(ctx) {\n    const { category } = ctx.req.param();\n    const categoryData = categories.find((cat) => cat.value === category);\n\n    if (!categoryData) {\n        throw new Error(`Category \"${category}\" not found`);\n    }\n\n    const apiUrl = `https://thewirehindi.com/wp-json/wp/v2/posts?categories=${categoryData.id}&_embed`;\n    const { data } = await got(apiUrl);\n\n    const items = data.map((v) => mapPostToItem(v));\n\n    return {\n        title: `The Wire Hindi - ${categoryData.label}`,\n        link: `https://thewirehindi.com/category/${category}/`,\n        item: items,\n        description: `Latest news from The Wire Hindi - ${categoryData.label} category`,\n        logo: 'https://thewirehindi.com/wp-content/uploads/2023/05/cropped-The-wire-32x32.jpeg',\n        language: 'hi',\n    } as Data;\n}\n","sourceCodeStart":45,"sourceCodeEnd":80,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/thewirehindi/category.ts#L45-L80","documentation":"The The Wire Hindi category route keeps a static categories array and finds the requested category by exact value match. If categories.find returns undefined (the :category param matches no entry), it throws a generic Error. This is purely a client-side validation against a hardcoded list before any API call.","triggerScenarios":"Requesting /thewirehindi/<category> with a value that does not equal any cat.value in the local categories array (typo, removed category, or a category that exists on the site but was not added to the list).","commonSituations":"User mistypes the category; a new site category was never added to the route's array; case mismatch between the URL and the stored value.","solutions":["Use a category value present in the route's categories array (open the route file to see valid values).","If the site has a new category, add it to the categories array with its WordPress id and label.","Throw InvalidParameterError instead of a generic Error for consistency with other routes."],"exampleFix":"// before\nconst categoryData = categories.find((cat) => cat.value === category);\nif (!categoryData) {\n    throw new Error(`Category \"${category}\" not found`);\n}\n\n// after: case-insensitive match and a clearer error\nconst categoryData = categories.find((cat) => cat.value.toLowerCase() === category.toLowerCase());\nif (!categoryData) {\n    throw new InvalidParameterError(`Category \"${category}\" not found. Supported: ${categories.map((c) => c.value).join(', ')}`);\n}","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set(categories.map((c) => c.value.toLowerCase()));\nfunction isSupportedCategory(c: string): boolean {\n    return SUPPORTED.has(c.toLowerCase());\n}\n// reject unsupported categories at the route boundary","typeGuard":"function isTheWireHindiCategory(c: string): boolean {\n    return categories.some((cat) => cat.value.toLowerCase() === c.toLowerCase());\n}","tryCatchPattern":"try {\n    return await handler(ctx);\n} catch (e) {\n    if (e instanceof Error && /Category .* not found/.test(e.message)) {\n        return notFound(`Supported: ${categories.map((c) => c.value).join(', ')}`);\n    }\n    throw e;\n}","preventionTips":["Use a category value present in the route's categories array.","Add new site categories to the array as they appear.","Match case-insensitively to absorb URL-casing differences."],"tags":["validation","parameter","wordpress","thewirehindi"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}