DIYgod/RSSHub · warning · InvalidParameterError
type not supported
Error message
type not supported
What it means
InvalidParameterError thrown by the UESTC 教务处 (jwc) route when ctx.req.param('type') is not an own property of typeUrlMap. Supported types: important, student, teacher, teaching, office. Same Object.hasOwn() guard pattern as the gr route.
Source
Thrown at lib/routes/uestc/jwc.ts:64
{
source: ['www.jwc.uestc.edu.cn/'],
target: '/jwc',
},
],
name: '教务处',
maintainers: ['achjqz', 'mobyw'],
handler,
url: 'www.jwc.uestc.edu.cn/',
description: `\
| 重要公告 | 学生事务公告 | 教师事务公告 | 教学新闻 | 办公室 |
| --------- | ------------ | ------------ | -------- | ------ |
| important | student | teacher | teaching | office |`,
};
async function handler(ctx: Context): Promise<Data> {
const type = ctx.req.param('type') || 'important';
if (!Object.hasOwn(typeUrlMap, type)) {
throw new InvalidParameterError('type not supported');
}
const typeName = typeNameMap[type];
const indexContent = await ofetch(baseUrl + typeUrlMap[type]);
const $ = load(indexContent);
const entries = $('div.textAreo.clearfix').toArray();
const items = entries.map(async (entry) => {
const element = $(entry);
const newsTitle = element.find('a').attr('title') ?? '';
const newsLink = detailUrl + element.find('a').attr('newsid');
const newsDetail = await cache.tryGet(newsLink, async () => {
const newsContent = await ofetch(newsLink);
const content = load(newsContent);
const basicInfo = content('div.detail_header').find('div.item').text();View on GitHub (pinned to bed535e087)
Solutions
- Use one of: important, student, teacher, teaching, office.
- Omit :type to default to 'important'.
- Update stale feed URLs.
Example fix
// before // /uestc/jwc/news // after // /uestc/jwc/important
Defensive patterns
Strategy: type-guard
Validate before calling
const JWC_TYPES = new Set(['important', 'student', 'teacher', 'teaching', 'office']);
function isValidJwcType(t: string | undefined): boolean {
return t === undefined || JWC_TYPES.has(t);
} Type guard
type JwcType = 'important' | 'student' | 'teacher' | 'teaching' | 'office';
function isJwcType(t: string): t is JwcType { return JWC_TYPES.has(t); } Prevention
- Use the documented English slugs exactly.
- Validate before constructing the feed URL.
- Omit :type for the default 'important' category.
When it happens
Trigger: Requesting /uestc/jwc/<type> with an unsupported slug; default is 'important'.
Common situations: Slug typo; renamed category; user guessed a Chinese-to-English mapping that does not match the implementation.
Related errors
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/19f7b5cd962fdfa4.
Report an issue: GitHub.