Skip to content

Commit

Permalink
services/runner: make ping err a lot less scary
Browse files Browse the repository at this point in the history
👻
  • Loading branch information
NathanX-S committed Nov 7, 2023
1 parent 7950399 commit c3b9774
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 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");
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);
}
Expand Down

0 comments on commit c3b9774

Please sign in to comment.