Skip to content

Commit

Permalink
Merge pull request #11 from NathanX-S/main
Browse files Browse the repository at this point in the history
services/runner: make ping err a lot less scary
  • Loading branch information
pauliusdotpro authored Nov 7, 2023
2 parents bf2b2d3 + 2af4a8b commit 70203da
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Services/RunnerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
// 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");
}
await Task.Delay(TimeSpan.FromMinutes(1), stoppingToken);
}
Expand Down

0 comments on commit 70203da

Please sign in to comment.