Skip to content

Commit

Permalink
Include status code in Uptime Kuma exception if able
Browse files Browse the repository at this point in the history
  • Loading branch information
FloatingMilkshake committed Oct 18, 2024
1 parent 6a83aa3 commit a26aedc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Events/HeartbeatEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ public static async Task Heartbeated(IGatewayClient client)
}
catch (Exception ex)
{
Program.Discord.Logger.LogWarning(Program.BotEventId, "Uptime Kuma heartbeat failed: {exType}: {exMessage}\n{stackTrace}", ex.GetType(), ex.Message, ex.StackTrace);
if (ex is HttpRequestException hrex)
Program.Discord.Logger.LogWarning(Program.BotEventId, "Uptime Kuma heartbeat failed with status code {statusCode}: {exType}: {exMessage}\n{stackTrace}", hrex.StatusCode, hrex.GetType(), hrex.Message, hrex.StackTrace);
else
Program.Discord.Logger.LogWarning(Program.BotEventId, "Uptime Kuma heartbeat failed: {exType}: {exMessage}\n{stackTrace}", ex.GetType(), ex.Message, ex.StackTrace);

Program.LastUptimeKumaHeartbeatStatus = "exception thrown";
}
}
Expand Down

0 comments on commit a26aedc

Please sign in to comment.