DIYgod/RSSHub · warning · InvalidParameterError

暂不支持对${type}的订阅

Error message

暂不支持对${type}的订阅

What it means

Thrown as an `InvalidParameterError` when the `type` path parameter for the NUA Library route does not match any of the supported `case` branches. The switch assigns `webPageName` CSS selectors for specific library navigation categories (like djdt, zydt, fwdt), and the default branch throws.

Source

Thrown at lib/routes/nua/lib.ts:55

async function handler(ctx) {
    const type = ctx.req.param('type');
    let webPageName;

    switch (type) {
        case 'xwdt':
            webPageName = '.wp_column.column-1.selected';
            break;
        case 'djdt':
            webPageName = '.wp_column.column-2.selected';
            break;
        case 'zydt':
            webPageName = '.wp_column.column-3.selected';
            break;
        case 'fwdt':
            webPageName = '.wp_column.column-4.selected';
            break;
        default:
            throw new InvalidParameterError(`暂不支持对${type}的订阅`);
    }

    const newsUrl = `${baseUrl}/${type}/list.htm`;
    const listName = 'div.news_con';
    const artiContent = '.wp_articlecontent';
    const listDate = '.news_date';

    const items = await util.ProcessList(newsUrl, baseUrl, listName, listDate, webPageName);
    const results = await util.ProcessFeed(items[0], artiContent);

    return {
        title: 'NUA-图书馆-' + items[1],
        link: `${baseUrl}/${type}/list.htm`,
        description: '南京艺术学院 图书馆 ' + items[1],
        item: results,
    };
}

View on GitHub (pinned to bed535e087)

Solutions

  1. Check the switch cases in `lib/routes/nua/lib.ts` for the complete list of supported type values (includes 'djdt', 'zydt', 'fwdt', and others above).
  2. Browse the NUA library website to identify the correct type identifier.
  3. Add a new `case` branch if the library added a new category.
Defensive patterns

Strategy: validation

Validate before calling

// Validate type against known switch cases
const validLibTypes = new Set(['xwgg', 'djdt', 'zydt', 'fwdt' /* ...all case labels */]);
if (!validLibTypes.has(type)) {
    throw new InvalidParameterError(`暂不支持对${type}的订阅`);
}

Type guard

function isSupportedLibType(type: string): boolean {
    return ['xwgg', 'djdt', 'zydt', 'fwdt'].includes(type);
}

Prevention

When it happens

Trigger: A user requests the NUA library route with a `type` value not among the predefined cases (which map to `.wp_column.column-N.selected` selectors). The type determines which news category page to scrape from the NUA library site.

Common situations: User passes an unsupported type value. The library website restructured its column layout. A bookmarked URL references an old type that was removed from the switch.

Related errors


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