diff --git a/lib/routes/36kr/hot-list.ts b/lib/routes/36kr/hot-list.ts index 46b072ddd..b546d4b14 100644 --- a/lib/routes/36kr/hot-list.ts +++ b/lib/routes/36kr/hot-list.ts @@ -4,6 +4,7 @@ import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { rootUrl, ProcessItem } from './utils'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; const categories = { 24: { @@ -54,6 +55,10 @@ export const route: Route = { async function handler(ctx) { const category = ctx.req.param('category') ?? '24'; + if (!categories[category]) { + throw new InvalidParameterError('This category does not exist. Please refer to the documentation for the correct usage.'); + } + const currentUrl = category === '24' ? rootUrl : `${rootUrl}/hot-list/catalog`; const response = await got({