DIYgod/RSSHub · warning · Error
Unsupported server
Error message
Unsupported server
What it means
Thrown by the azurlane news route when the :server parameter (upper-cased) is not 'JP'. Only the Japanese server (ja handler hitting www.azurlane.jp) is currently implemented; any other server value falls through the switch default and is rejected.
Source
Thrown at lib/routes/azurlane/news.ts:36
const body: string[] = [];
for (const key in mapping) {
heading.push(mapping[key]);
separator.push(':--:');
body.push(key);
}
return [heading.join(' | '), separator.join(' | '), body.join(' | ')].map((s) => `| ${s} |`).join('\n');
};
const handler: Route['handler'] = async (ctx) => {
const { server } = ctx.req.param();
switch (server.toUpperCase()) {
case 'JP':
return await ja(ctx);
default:
throw new Error('Unsupported server');
}
};
const ja: Route['handler'] = async (ctx) => {
const { type = '0' } = ctx.req.param();
const response = await ofetch<{ data: { rows: Array<{ id: number; content: string; title: string; publishTime: number }> } }>('https://www.azurlane.jp/api/news/list', {
query: {
type,
index: 1,
size: 15,
},
});
const list = response.data?.rows || [];
const items = list.map((item) => ({
title: item.title,
description: item.content,View on GitHub (pinned to bed535e087)
Solutions
- Use /azurlane/news/JP (or any case of jp) which is the only implemented server.
- To support another server, add a case branch (e.g. case 'CN') with its handler and remove/extend the default.
Example fix
// before
switch (server.toUpperCase()) {
case 'JP':
return await ja(ctx);
default:
throw new Error('Unsupported server');
}
// after
const HANDLERS = { JP: ja } as const;
const handler = HANDLERS[server.toUpperCase()];
if (!handler) {
throw new InvalidParameterError(`Unsupported server: ${server}. Supported: ${Object.keys(HANDLERS).join(', ')}`);
}
return handler(ctx); Defensive patterns
Strategy: validation
Validate before calling
const HANDLERS = { JP: ja } as const;
const key = ctx.req.param('server').toUpperCase() as keyof typeof HANDLERS;
if (!(key in HANDLERS)) {
throw new InvalidParameterError(`Unsupported server. Supported: ${Object.keys(HANDLERS).join(', ')}`);
} Type guard
const SUPPORTED_SERVERS = new Set(['JP']);
function isSupportedServer(s: string): boolean {
return SUPPORTED_SERVERS.has(s.toUpperCase());
} Prevention
- Drive the switch from a lookup object so the supported list and error message share one source of truth.
- Document (or 4xx) rather than silently misroute unsupported servers.
When it happens
Trigger: Calling /azurlane/news/:server with server set to CN, EN, KR, or any non-JP value; the switch's default branch executes.
Common situations: User assumes all Azur Lane servers are supported; outdated docs list servers that were never implemented; server code typed in wrong case is fine (toUpperCase normalizes) but a wrong code still throws.
Related errors
- 暂不支持对${type}的订阅
- 无效的排序类型
- 关键词不能为空
- Tag not found
- Invalid id: ${id}. Allowed values are: ${[...validIds].join(
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/b860a65553c7a10f.
Report an issue: GitHub.