From 0e6ac14b74ea74aef321eac06158a2c8390069ec Mon Sep 17 00:00:00 2001 From: John Gross Date: Thu, 6 Jun 2019 18:06:28 -0700 Subject: [PATCH] Error handling --- Torch.Server/Program.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Torch.Server/Program.cs b/Torch.Server/Program.cs index ea59df0..731dd02 100644 --- a/Torch.Server/Program.cs +++ b/Torch.Server/Program.cs @@ -9,6 +9,7 @@ using System.ServiceProcess; using System.Text; using System.Threading; using NLog; +using NLog.Fluent; using NLog.Targets; using Torch.Utils; @@ -35,11 +36,19 @@ namespace Torch.Server { "System.Security.Principal.Windows.dll" }; - - foreach (var file in badDlls) + + try { - if (File.Exists(file)) - File.Delete(file); + foreach (var file in badDlls) + { + if (File.Exists(file)) + File.Delete(file); + } + } + catch + { + LogManager.GetCurrentClassLogger().Error($"Error updating. Please delete the following files from the Torch root folder manually:\r\n{string.Join("\r\n", badDlls)}"); + return; } if (!TorchLauncher.IsTorchWrapped())