{"record":{"id":"4bc3a677bede7b34","repo":"babalae/better-genshin-impact","slug":"meow-response-statuscode","errorCode":null,"errorMessage":"MeoW 调用失败，状态码: {response.StatusCode}","messagePattern":"MeoW 调用失败，状态码: (.+?)","errorType":"http","errorClass":"NotifierException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/Service/Notifier/MeowNotifier.cs","lineNumber":46,"sourceCode":"        _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        {\n            throw new NotifierException($\"Error sending MeoW message: {ex.Message}\");\n        }\n    }\n\n    private string BuildUrl()\n    {\n        var url = $\"https://api.chuckfang.com/{Uri.EscapeDataString(_nickname)}\";\n        if (!string.IsNullOrEmpty(_title))\n        {\n            url += $\"/{Uri.EscapeDataString(_title)}\";","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Service/Notifier/MeowNotifier.cs#L28-L64","documentation":"Thrown when the POST to https://api.chuckfang.com/{nickname}[/title] returns a non-success HTTP status. The notifier does not inspect the body, only response.IsSuccessStatusCode, so any 4xx/5xx becomes this generic message including the StatusCode enum value.","triggerScenarios":"_httpClient.PostAsync(url, BuildContent(content)) completes but response.IsSuccessStatusCode is false; common codes: 404 (unknown nickname/title), 429 (rate limit), 5xx (service down), 400 (malformed path).","commonSituations":"Nickname typo so the path 404s; chuckfang.com service outage; rapid repeated notifications triggering rate limiting; special characters in title that escape oddly.","solutions":["Read the response body and include it in the exception for diagnosis (the current code discards it).","Verify the nickname exactly matches a registered MeoW account.","For 429 responses, add backoff/retry before surfacing the error to the user.","Check https://api.chuckfang.com status if 5xx persists."],"exampleFix":"// before\nusing var response = await _httpClient.PostAsync(url, BuildContent(content));\nif (!response.IsSuccessStatusCode)\n{\n    throw new NotifierException($\"MeoW 调用失败，状态码: {response.StatusCode}\");\n}\n\n// after\nusing var response = await _httpClient.PostAsync(url, BuildContent(content));\nif (!response.IsSuccessStatusCode)\n{\n    var body = await response.Content.ReadAsStringAsync();\n    throw new NotifierException($\"MeoW 调用失败，状态码: {response.StatusCode}, 响应: {body}\");\n}","handlingStrategy":"retry","validationCode":"var url = $\"https://api.chuckfang.com/{Uri.EscapeDataString(nickname)}\";\nif (!Uri.TryCreate(url, UriKind.Absolute, out _))\n    throw new InvalidOperationException(\"Built MeoW URL is not valid.\");","typeGuard":null,"tryCatchPattern":"for (int attempt = 0; attempt < 3; attempt++)\ntry { await meowNotifier.SendAsync(data); break; }\ncatch (NotifierException ex) when (ex.Message.Contains(\"调用失败\") && attempt < 2)\n{ await Task.Delay(TimeSpan.FromSeconds(2 * (attempt + 1))); }","preventionTips":["Verify the nickname is registered with the MeoW service.","Add a retry with backoff for 5xx/429 from chuckfang.com.","Surface the response body in the error for faster diagnosis."],"tags":["meow","http","api-failure","notifier"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}