Feature UnhandledException handled

This commit is contained in:
Somebody
2024-09-14 17:13:56 +08:00
parent 7b5d404906
commit 6681c761e3
4 changed files with 14 additions and 0 deletions

View File

@@ -32,6 +32,14 @@ public class EntryPoint
Logger.Info(I18NManager.Translate("Server.ServerInfo.Shutdown"));
PerformCleanup();
};
AppDomain.CurrentDomain.UnhandledException += (obj, arg) =>
{
Logger.Error(I18NManager.Translate("Server.ServerInfo.UnhandledException", obj.GetType().Name), (Exception)arg.ExceptionObject);
Logger.Info(I18NManager.Translate("Server.ServerInfo.Shutdown"));
PerformCleanup();
Environment.Exit(1);
};
Console.CancelKeyPress += (_, eventArgs) =>
{
Logger.Info(I18NManager.Translate("Server.ServerInfo.CancelKeyPressed"));