{"record":{"id":"9c9e69d72d05272f","repo":"DIYgod/RSSHub","slug":"unhandle-type-c-type","errorCode":null,"errorMessage":"Unhandle type: ${c.type}","messagePattern":"Unhandle type: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/routes/famitsu/category.tsx","lineNumber":94,"sourceCode":"        case 'ITEMIZATION':\n        case 'ITEMIZATION_NUM':\n        case 'NOLINK':\n        case 'PBOX':\n        case 'STRING':\n        case 'TWITTER':\n        case 'YOUTUBE':\n            return `<div><span>${c.content}</span></div>`;\n        case 'BUTTON':\n        case 'BUTTON_ANDROID':\n        case 'BUTTON_EC':\n        case 'BUTTON_IOS':\n        case 'BUTTON_QUESTION':\n        case 'BUTTON_TAB':\n        case 'LINK':\n        case 'LINK_TAB':\n            return `<a href=\"${c.url}\">${c.content}</a><br>`;\n        default:\n            throw new Error(`Unhandle type: ${c.type}`);\n    }\n}\n\nasync function handler(ctx) {\n    const { category = 'new-article' } = ctx.req.param();\n    const url = `${baseUrl}/category/${category}/page/1`;\n\n    const buildId = await getBuildId();\n\n    const data = await ofetch(`https://www.famitsu.com/_next/data/${buildId}/category/${category}/page/1.json`, {\n        query: {\n            categoryCode: category,\n            pageNumber: 1,\n        },\n    });\n\n    const list = (data.pageProps.categoryArticleDataForPc as CategoryArticle[])\n        .filter((item) => !item.advertiserName)","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/famitsu/category.tsx#L76-L112","documentation":"Famitsu article bodies are arrays of typed components. The switch handles TEXT, YOUTUBE, several BUTTON_* variants, and LINK/LINK_TAB; every other `c.type` hits `default` and throws a generic Error (the message reads 'Unhandle type' — a typo). This is a parser-completeness gap.","triggerScenarios":"Famitsu introduces a component type the switch doesn't cover (e.g. IMAGE, GALLERY, VIDEO, EMBED, CAROUSEL).","commonSituations":"A site relaunch adds new block types; only articles using the new blocks fail.","solutions":["Inspect the component `type` from the error message and add a rendering case.","Return an empty string in the `default` arm for graceful degradation.","Optionally correct the message typo ('Unhandle' -> 'Unhandled') when patching."],"exampleFix":"// before\n//   default:\n//       throw new Error(`Unhandle type: ${c.type}`);\n// after\n//   default:\n//       return '';","handlingStrategy":"fallback","validationCode":"const HANDLED = new Set(['TEXT', 'YOUTUBE', 'BUTTON', 'BUTTON_ANDROID', 'BUTTON_EC', 'BUTTON_IOS', 'BUTTON_QUESTION', 'BUTTON_TAB', 'LINK', 'LINK_TAB']);\nfunction isHandledComponent(c: { type: string }): boolean {\n  return HANDLED.has(c.type);\n}","typeGuard":"function isHandledComponent(c: { type: string }): boolean {\n  return HANDLED.has(c.type);\n}","tryCatchPattern":"try {\n  return renderComponent(c);\n} catch {\n  return '';\n}","preventionTips":["Return '' in the default arm instead of throwing.","Add the new component type as a case whenever one appears.","Fix the message typo while patching."],"tags":["api","parsing","switch-default","schema-drift"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}