{"record":{"id":"37d289e579e8324e","repo":"babalae/better-genshin-impact","slug":"error-37d289","errorCode":null,"errorMessage":"未知角色信息分类。","messagePattern":"未知角色信息分类。","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/CharacterDevelopment/CharacterDevelopmentTask.cs","lineNumber":1220,"sourceCode":"    {\n        var captureRect = TaskContext.Instance().SystemInfo.ScaleMax1080PCaptureRect;\n        return new Rect(0, 0, (int)(captureRect.Width * 0.2), captureRect.Height);\n    }\n\n    private static Rect GetTalentListRoi(ImageRegion capture)\n    {\n        var x = (int)(capture.Width * 0.8);\n        return new Rect(x, 0, capture.Width - x, capture.Height);\n    }\n\n    private static string GetCategoryText(CharacterDevelopmentCategory category)\n    {\n        return category switch\n        {\n            CharacterDevelopmentCategory.Attribute => \"属性\",\n            CharacterDevelopmentCategory.Weapon => \"武器\",\n            CharacterDevelopmentCategory.Talent => \"天赋\",\n            _ => throw new ArgumentOutOfRangeException(nameof(category), category, \"未知角色信息分类。\")\n        };\n    }\n}\n","sourceCodeStart":1202,"sourceCodeEnd":1224,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/CharacterDevelopment/CharacterDevelopmentTask.cs#L1202-L1224","documentation":"`GetCategoryText` maps each `CharacterDevelopmentCategory` flag to its Chinese tab label and throws `ArgumentOutOfRangeException` for any unmapped value. With Attribute/Weapon/Talent all handled, the default is unreachable unless a new enum member is added without updating the switch or an invalid flag combination (a numeric cast) is passed.","triggerScenarios":"A future `CharacterDevelopmentCategory` member not handled in the switch; an explicitly cast invalid integer passed as the category; `None` reaching this function (it is normally filtered earlier).","commonSituations":"Enum extension without updating all exhaustiveness switches; tests passing `default`/`(CharacterDevelopmentCategory)999`.","solutions":["When adding a category, update `GetCategoryText`, `GetOrderedCategories`, and the `ReadCategory` switch together.","Ensure only valid, set flags reach `GetCategoryText` (filter `None` upstream).","In tests, pass real enum members, not arbitrary casts."],"exampleFix":"// before\nGetCategoryText((CharacterDevelopmentCategory)99); // throws\n\n// after: pass a real flag\nGetCategoryText(CharacterDevelopmentCategory.Attribute);","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"static bool IsKnownCategory(CharacterDevelopmentCategory c) =>\n    c == CharacterDevelopmentCategory.Attribute\n    || c == CharacterDevelopmentCategory.Weapon\n    || c == CharacterDevelopmentCategory.Talent;","tryCatchPattern":null,"preventionTips":["Filter None upstream so only set, known flags reach GetCategoryText.","When adding a category, update GetCategoryText, GetOrderedCategories, and ReadCategory together.","In tests, pass real enum members, not arbitrary integer casts."],"tags":["switch-enum","argumentoutofrange","invariant","character-development"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}