Skip to content

Commit 9527c94

Browse files
Enhance logging for forum topic creation failures and improve health check response message
1 parent bbc09b9 commit 9527c94

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/XtremeIdiots.Portal.Integrations.Forums/AdminActionTopics.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ public async Task<int> CreateTopicForAdminAction(AdminActionType type, GameType
4949

5050
if (postTopicResult?.Result?.Data is null)
5151
{
52-
logger.LogWarning("Failed to create forum topic for admin action - null response");
52+
logger.LogWarning("Failed to create forum topic for admin action - StatusCode: {StatusCode}, Errors: {Errors}",
53+
postTopicResult?.StatusCode,
54+
postTopicResult?.Result?.Errors is { Length: > 0 } errors
55+
? string.Join("; ", errors.Select(e => $"{e.Code}: {e.Message}"))
56+
: "no error details available");
5357
return 0;
5458
}
5559

src/XtremeIdiots.Portal.Web/ApiControllers/HealthCheckController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public HealthCheckController(
4242
{
4343
var response = await this.forumsClient.Core.GetCoreHello().ConfigureAwait(false);
4444
var checkResponse = response?.Result?.Data?.CommunityUrl == "https://www.xtremeidiots.com/";
45-
return new Tuple<bool, string>(checkResponse, "OK");
45+
return new Tuple<bool, string>(checkResponse, checkResponse ? "OK" : "Unexpected or missing CommunityUrl in forums API response");
4646
}
4747
catch (Exception ex)
4848
{

0 commit comments

Comments
 (0)