{"record":{"id":"b54098a00f0c97ee","repo":"DIYgod/RSSHub","slug":"error-b54098","errorCode":null,"errorMessage":"不支持指定类型！","messagePattern":"不支持指定类型！","errorType":"exception","errorClass":"InvalidParameterError","httpStatus":null,"severity":"error","filePath":"lib/routes/dlsite/campaign.ts","lineNumber":156,"sourceCode":"    features: {\n        requireConfig: false,\n        requirePuppeteer: false,\n        antiCrawler: false,\n        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n        nsfw: true,\n    },\n    name: 'Discounted Works',\n    maintainers: ['cssxsh'],\n    handler,\n};\n\nasync function handler(ctx) {\n    const info = infos[ctx.req.param('type')];\n    // 判断参数是否合理\n    if (info === undefined) {\n        throw new InvalidParameterError('不支持指定类型！');\n    }\n    if (ctx.req.param('free') !== undefined) {\n        info.params.is_free = 1;\n    }\n    const link = setUrl(info);\n\n    const response = await got(new URL(link, host), {\n        method: 'GET',\n    });\n    const data = response.data;\n    const $ = load(data);\n\n    const title = `${info.name} | 割引中の作品`;\n    const description = $('meta[name=\"description\"]').attr('content');\n    const list = $('tr[class]', '.n_worklist');\n    const item = list.toArray().map((element) => {\n        const title = $('.work_name', element).text();\n        const link = $('.work_name > a', element).attr('href');","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/dlsite/campaign.ts#L138-L174","documentation":"Thrown by the DLsite campaign (discounted works) route when the `type` path parameter does not match any key in the `infos` lookup object. The valid keys are: `home`, `comic`, `soft`, `maniax`, `books`, `pro`, `girls`, `bl`. The handler does a direct property lookup (`infos[ctx.req.param('type')]`) and throws InvalidParameterError if the result is `undefined`.","triggerScenarios":"Calling the route with a type value not in the infos object (e.g. `/dlsite/campaign/furry`, `/dlsite/campaign/r18`); typos in the type parameter; using an uppercase variant like `/dlsite/campaign/Home` (keys are lowercase).","commonSituations":"Developer copies a type name from another DLsite route or documentation that uses different naming; user enters a category that exists on the DLsite website but is not mapped in this route's `infos` object.","solutions":["Check the valid type values against the route description table: home, comic, soft, maniax, books, pro, girls, bl.","Ensure the type parameter is lowercase — the infos keys are all lowercase.","Verify the route path format: /dlsite/campaign/<type> (e.g. /dlsite/campaign/home)."],"exampleFix":"// before\nconst info = infos[ctx.req.param('type')];\nif (info === undefined) {\n    throw new InvalidParameterError('不支持指定类型！');\n}\n\n// after — include valid options in the error message\nif (info === undefined) {\n    throw new InvalidParameterError(`Unsupported type '${ctx.req.param('type')}'. Valid types: ${Object.keys(infos).join(', ')}`);\n}","handlingStrategy":"validation","validationCode":"// Validate the type parameter before making the request\nconst validTypes = ['home', 'comic', 'soft', 'maniax', 'books', 'pro', 'girls', 'bl'];\nfunction isValidDlsiteType(type: string): boolean {\n    return validTypes.includes(type.toLowerCase());\n}\n\n// Usage\nconst type = userInput;\nif (!isValidDlsiteType(type)) {\n    throw new Error(`Invalid type. Valid: ${validTypes.join(', ')}`);\n}","typeGuard":"function isDlsiteCampaignType(value: string): value is 'home' | 'comic' | 'soft' | 'maniax' | 'books' | 'pro' | 'girls' | 'bl' {\n    return ['home', 'comic', 'soft', 'maniax', 'books', 'pro', 'girls', 'bl'].includes(value);\n}","tryCatchPattern":"try {\n    const feed = await fetch(`${rsshubUrl}/dlsite/campaign/${type}`);\n} catch (e) {\n    if (e.message.includes('不支持指定类型')) {\n        console.error(`Invalid type '${type}'. Use one of: home, comic, soft, maniax, books, pro, girls, bl`);\n    }\n    throw e;\n}","preventionTips":["Always lowercase the type parameter before using it in the route URL.","Refer to the route description table for the valid type mapping.","If building a client, validate against the known type list before making the request."],"tags":["dlsite","invalid-parameter","parameter-validation","lookup-table"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}