From c3b9774d94d7b9fb1acaeb6a55542cb2ec30bcdd Mon Sep 17 00:00:00 2001 From: NathanX-S Date: Tue, 7 Nov 2023 13:24:52 -0500 Subject: [PATCH 1/3] services/runner: make ping err a lot less scary :ghost: --- Services/RunnerService.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Services/RunnerService.cs b/Services/RunnerService.cs index 47146f1..d290caa 100644 --- a/Services/RunnerService.cs +++ b/Services/RunnerService.cs @@ -30,13 +30,15 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) if(!status) { - throw new Exception("Server is down"); + throw new Exception("Server is down."); } } - catch(Exception e) + // A simplified, more dev-friendly error if we hit a rather standard error. + catch(HttpRequestException httpException) { - await _discordService.SetPresence(ActivityType.Watching, "server status: DOWN !"); - Log.Error(e, "RunnerService"); + await _discordService.SetPresence(ActivityType.Watching, "Server status: DOWN !"); + // A warning is more accurate to something that may cause issues if not resolved. + Log.Warning($"RunnerService: Caught HttpRequestException from initial serverApi.GetPing: {httpException.Message}", "RunnerService"); } await Task.Delay(TimeSpan.FromMinutes(1), stoppingToken); } From a962bd875b565d8b4ec864ee4d8b3e6a1e3d9b17 Mon Sep 17 00:00:00 2001 From: Nathan S <55564547+NathanX-S@users.noreply.github.com> Date: Tue, 7 Nov 2023 13:27:01 -0500 Subject: [PATCH 2/3] Update RunnerService.cs oops :) --- Services/RunnerService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Services/RunnerService.cs b/Services/RunnerService.cs index d290caa..6272349 100644 --- a/Services/RunnerService.cs +++ b/Services/RunnerService.cs @@ -38,7 +38,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) { await _discordService.SetPresence(ActivityType.Watching, "Server status: DOWN !"); // A warning is more accurate to something that may cause issues if not resolved. - Log.Warning($"RunnerService: Caught HttpRequestException from initial serverApi.GetPing: {httpException.Message}", "RunnerService"); + Log.Warning($"RunnerService: Caught HttpRequestException from serverApi.GetPing: {httpException.Message}", "RunnerService"); } await Task.Delay(TimeSpan.FromMinutes(1), stoppingToken); } From 2af4a8ba459a9c6bb33db5a32b4b6384544747b4 Mon Sep 17 00:00:00 2001 From: Nathan S <55564547+NathanX-S@users.noreply.github.com> Date: Tue, 7 Nov 2023 13:34:44 -0500 Subject: [PATCH 3/3] Update RunnerService.cs --- Services/RunnerService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Services/RunnerService.cs b/Services/RunnerService.cs index 6272349..a5bb52d 100644 --- a/Services/RunnerService.cs +++ b/Services/RunnerService.cs @@ -36,7 +36,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) // A simplified, more dev-friendly error if we hit a rather standard error. catch(HttpRequestException httpException) { - await _discordService.SetPresence(ActivityType.Watching, "Server status: DOWN !"); + await _discordService.SetPresence(ActivityType.Watching, "server status: DOWN !"); // A warning is more accurate to something that may cause issues if not resolved. Log.Warning($"RunnerService: Caught HttpRequestException from serverApi.GetPing: {httpException.Message}", "RunnerService"); }