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

  1. Use /azurlane/news/JP (or any case of jp) which is the only implemented server.
  2. 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

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


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/b860a65553c7a10f. Report an issue: GitHub.