From 1f0991f695be3c10100d8839c6dfda3c22bc701c Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 6 Oct 2025 12:16:49 +0100 Subject: [PATCH] Prevent closing the server if an exception happens --- SPTarkov.Server/Program.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/SPTarkov.Server/Program.cs b/SPTarkov.Server/Program.cs index 60dce127..c5ba567e 100644 --- a/SPTarkov.Server/Program.cs +++ b/SPTarkov.Server/Program.cs @@ -26,6 +26,23 @@ namespace SPTarkov.Server; public static class Program { public static async Task Main(string[] args) + { + try + { + await StartServer(args); + } + catch (Exception e) + { + Console.WriteLine("========================================================================================================="); + Console.WriteLine("The server has unexpectedly stopped, please check your log files and reach out to #spt-support in discord"); + Console.WriteLine(e); + Console.WriteLine("========================================================================================================="); + Console.WriteLine("Press any key to exit..."); + Console.ReadLine(); + } + } + + public static async Task StartServer(string[] args) { Console.OutputEncoding = Encoding.UTF8; @@ -95,6 +112,7 @@ public static class Program { Console.WriteLine(ex); serverExceptionLogger.LogCritical(ex, "Critical exception, stopping server..."); + throw; } finally {