{"record":{"id":"b2fb186616e3d61f","repo":"babalae/better-genshin-impact","slug":"meow","errorCode":null,"errorMessage":"MeoW 昵称为空","messagePattern":"MeoW 昵称为空","errorType":"validation","errorClass":"NotifierException","httpStatus":null,"severity":"warning","filePath":"BetterGenshinImpact/Service/Notifier/MeowNotifier.cs","lineNumber":36,"sourceCode":"    private readonly string _title;\n\n    private readonly JsonSerializerOptions _jsonSerializerOptions = new()\n    {\n        PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,\n    };\n\n    public MeowNotifier(HttpClient httpClient, string nickname, string title)\n    {\n        _httpClient = httpClient;\n        _nickname = nickname;\n        _title = title;\n    }\n\n    public async Task SendAsync(BaseNotificationData content)\n    {\n        if (string.IsNullOrWhiteSpace(_nickname))\n        {\n            throw new NotifierException(\"MeoW 昵称为空\");\n        }\n\n        try\n        {\n            var url = BuildUrl();\n            using var response = await _httpClient.PostAsync(url, BuildContent(content));\n\n            if (!response.IsSuccessStatusCode)\n            {\n                throw new NotifierException($\"MeoW 调用失败，状态码: {response.StatusCode}\");\n            }\n        }\n        catch (NotifierException)\n        {\n            throw;\n        }\n        catch (System.Exception ex)\n        {","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Service/Notifier/MeowNotifier.cs#L18-L54","documentation":"MeowNotifier.SendAsync rejects an empty/whitespace _nickname (passed to the constructor) before building the request URL, because the nickname is the only required path segment for the chuckfang.com push API. Without it the URL would be malformed, so the notifier fails fast.","triggerScenarios":"MeowNotifier constructed with nickname that is null, empty, or whitespace-only; SendAsync's IsNullOrWhiteSpace(_nickname) guard at line 34 fires.","commonSituations":"Settings migration left the MeoW nickname field blank; user enabled the MeoW notifier but never filled the nickname; a default-empty binding wired the textbox to the constructor.","solutions":["Set a non-empty MeoW nickname in the notifier settings UI/config before enabling the channel.","Gate notifier registration so MeowNotifier is only added when nickname is non-whitespace.","Add a settings-page validation hint so the user cannot save an enabled MeoW channel without a nickname."],"exampleFix":"// before\nvar notifier = new MeowNotifier(httpClient, nickname, title);\n\n// after\nif (string.IsNullOrWhiteSpace(nickname))\n    throw new InvalidOperationException(\"MeoW nickname must be configured before constructing MeowNotifier.\");\nvar notifier = new MeowNotifier(httpClient, nickname, title);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(nickname))\n    throw new InvalidOperationException(\"Configure a MeoW nickname before sending.\");","typeGuard":"static bool IsMeowConfigured(string nickname) => !string.IsNullOrWhiteSpace(nickname);","tryCatchPattern":"try { await meowNotifier.SendAsync(data); }\ncatch (NotifierException ex) when (ex.Message.Contains(\"昵称为空\"))\n{ /* prompt user to fill nickname, do not retry */ }","preventionTips":["Block enabling the MeoW channel in settings until nickname is non-empty.","Trim and validate the nickname field on save."],"tags":["meow","config","validation","notifier"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}