DIYgod/RSSHub · warning · InvalidParameterError
not support platform
Error message
not support platform
What it means
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.
Source
Thrown at lib/routes/tencent/qq/sdk/changelog.ts:37
},
name: '更新日志',
maintainers: ['nuomi1'],
handler,
};
async function handler(ctx) {
const platform = ctx.req.param('platform');
let title: string;
let link: string;
if (platform === 'iOS') {
title = 'iOS SDK 历史变更';
link = 'https://wiki.connect.qq.com/ios_sdk历史变更';
} else if (platform === 'Android') {
title = 'Android SDK 历史变更';
link = 'https://wiki.connect.qq.com/android_sdk历史变更';
} else {
throw new InvalidParameterError('not support platform');
}
const response = await got.get(link);
const $ = load(response.data);
// 获取主要文本,并且过滤空行
const contents = $('.wp-editor')
.children('p')
.filter((_, element) => $(element).text() !== '');
const pList: string[] = [];
const titleIndex: number[] = [];
// 遍历文本 p 标签,并且获取标题索引
contents.each((index, element) => {
if ($(element).find('strong').length) {
titleIndex.push(index);View on GitHub (pinned to bed535e087)
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.
Example fix
// before
if (platform === 'iOS') { ... }
else if (platform === 'Android') { ... }
else { throw new InvalidParameterError('not support platform'); }
// after: case-insensitive with a clear error listing valid values
const p = platform?.toLowerCase();
if (p === 'ios') { ... }
else if (p === 'android') { ... }
else { throw new InvalidParameterError(`Unsupported platform "${platform}". Supported: iOS, Android`); } Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED_PLATFORMS = new Set(['ios', 'android']);
function isSupportedPlatform(p: string | undefined): boolean {
return !!p && SUPPORTED_PLATFORMS.has(p.toLowerCase());
}
// reject the request before it reaches the handler if !isSupportedPlatform(platform) Type guard
function isQqSdkPlatform(p: string | undefined): p is 'iOS' | 'Android' {
return p === 'iOS' || p === 'Android';
} Try / catch
try {
return await handler(ctx);
} catch (e) {
if (e instanceof InvalidParameterError && /not support platform/.test(e.message)) {
// return a 400 listing supported platforms
return badRequest('Supported platforms: iOS, Android');
}
throw e;
} Prevention
- 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.
When it happens
Trigger: A request like /tencent/qq/sdk/changelog/windows or any path segment other than exactly 'iOS' or 'Android' (the comparison is case-sensitive).
Common situations: 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.
Related errors
- Bad timeRange range. See <a href="https://docs.rsshub.app/ro
- Bad parameter. See <a href="https://docs.rsshub.app/routes/g
- Invalid city
- Invalid channel name
- This category does not exist. Please refer to the documentat
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/b507b5b5476c1512.
Report an issue: GitHub.