{"record":{"id":"b507b5b5476c1512","repo":"DIYgod/RSSHub","slug":"not-support-platform","errorCode":null,"errorMessage":"not support platform","messagePattern":"not support platform","errorType":"exception","errorClass":"InvalidParameterError","httpStatus":503,"severity":"warning","filePath":"lib/routes/tencent/qq/sdk/changelog.ts","lineNumber":37,"sourceCode":"    },\n    name: '更新日志',\n    maintainers: ['nuomi1'],\n    handler,\n};\n\nasync function handler(ctx) {\n    const platform = ctx.req.param('platform');\n\n    let title: string;\n    let link: string;\n    if (platform === 'iOS') {\n        title = 'iOS SDK 历史变更';\n        link = 'https://wiki.connect.qq.com/ios_sdk历史变更';\n    } else if (platform === 'Android') {\n        title = 'Android SDK 历史变更';\n        link = 'https://wiki.connect.qq.com/android_sdk历史变更';\n    } else {\n        throw new InvalidParameterError('not support platform');\n    }\n\n    const response = await got.get(link);\n\n    const $ = load(response.data);\n\n    // 获取主要文本，并且过滤空行\n    const contents = $('.wp-editor')\n        .children('p')\n        .filter((_, element) => $(element).text() !== '');\n\n    const pList: string[] = [];\n    const titleIndex: number[] = [];\n\n    // 遍历文本 p 标签，并且获取标题索引\n    contents.each((index, element) => {\n        if ($(element).find('strong').length) {\n            titleIndex.push(index);","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/tencent/qq/sdk/changelog.ts#L19-L55","documentation":"The QQ SDK changelog route has only two supported platforms: 'iOS' and 'Android'. The handler throws InvalidParameterError for any other value of the :platform path parameter because there is no changelog page for it.","triggerScenarios":"A request like /tencent/qq/sdk/changelog/windows or any path segment other than exactly 'iOS' or 'Android' (the comparison is case-sensitive).","commonSituations":"User mistypes or wrong-cases the platform ('ios', 'android', 'IOS'); an aggregator constructs the URL from a lowercased value; someone expects a generic platform that was never implemented.","solutions":["Use exactly 'iOS' or 'Android' as the path segment (note the casing).","If case-insensitive matching is desired, normalize platform to the canonical form before the if/else.","Add the new platform branch only if wiki.connect.qq.com actually has a changelog page for it."],"exampleFix":"// before\nif (platform === 'iOS') { ... }\nelse if (platform === 'Android') { ... }\nelse { throw new InvalidParameterError('not support platform'); }\n\n// after: case-insensitive with a clear error listing valid values\nconst p = platform?.toLowerCase();\nif (p === 'ios') { ... }\nelse if (p === 'android') { ... }\nelse { throw new InvalidParameterError(`Unsupported platform \"${platform}\". Supported: iOS, Android`); }","handlingStrategy":"validation","validationCode":"const SUPPORTED_PLATFORMS = new Set(['ios', 'android']);\nfunction isSupportedPlatform(p: string | undefined): boolean {\n    return !!p && SUPPORTED_PLATFORMS.has(p.toLowerCase());\n}\n// reject the request before it reaches the handler if !isSupportedPlatform(platform)","typeGuard":"function isQqSdkPlatform(p: string | undefined): p is 'iOS' | 'Android' {\n    return p === 'iOS' || p === 'Android';\n}","tryCatchPattern":"try {\n    return await handler(ctx);\n} catch (e) {\n    if (e instanceof InvalidParameterError && /not support platform/.test(e.message)) {\n        // return a 400 listing supported platforms\n        return badRequest('Supported platforms: iOS, Android');\n    }\n    throw e;\n}","preventionTips":["Use exactly 'iOS' or 'Android' (case-sensitive) as the path segment.","Normalize the input case at the route boundary if you want lenient matching.","Document the two valid values in the route's parameters/README."],"tags":["validation","parameter","tencent"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}