Skip to content

Commit

Permalink
additional error handling to prevent core dumps
Browse files Browse the repository at this point in the history
  • Loading branch information
zivillian committed Nov 15, 2021
1 parent cf380c9 commit daee8e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/ommstats/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,25 @@ static async Task Main(string[] args)
}
catch (SocketException ex)
{
logger.LogError(ex, "Error while executing OmmStats");
logger.LogError(ex, "Connection error while executing OmmStats");
}
catch (Exception ex)
{
logger.LogError(ex, "Error while executing OmmStats");
throw;
}
Console.CancelKeyPress -= Cancelled;
if (!cts.IsCancellationRequested)
{
try
{
cts.Cancel();
}
catch
{
//don't care, something else failed before
}
}
void Cancelled(object s, ConsoleCancelEventArgs e)
{
logger.LogInformation("stopping...");
Expand Down

0 comments on commit daee8e0

Please sign in to comment.