diff --git a/neo-cli/Program.cs b/neo-cli/Program.cs index a3253aeac..4165a3788 100644 --- a/neo-cli/Program.cs +++ b/neo-cli/Program.cs @@ -1,51 +1,13 @@ using Neo.CLI; -using System; -using System.IO; namespace Neo { static class Program { - private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) - { - using (FileStream fs = new FileStream("error.log", FileMode.Create, FileAccess.Write, FileShare.None)) - using (StreamWriter w = new StreamWriter(fs)) - if (e.ExceptionObject is Exception ex) - { - PrintErrorLogs(w, ex); - } - else - { - w.WriteLine(e.ExceptionObject.GetType()); - w.WriteLine(e.ExceptionObject); - } - } - static void Main(string[] args) { - AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; var mainService = new MainService(); mainService.Run(args); } - - private static void PrintErrorLogs(StreamWriter writer, Exception ex) - { - writer.WriteLine(ex.GetType()); - writer.WriteLine(ex.Message); - writer.WriteLine(ex.StackTrace); - if (ex is AggregateException ex2) - { - foreach (Exception inner in ex2.InnerExceptions) - { - writer.WriteLine(); - PrintErrorLogs(writer, inner); - } - } - else if (ex.InnerException != null) - { - writer.WriteLine(); - PrintErrorLogs(writer, ex.InnerException); - } - } } } diff --git a/neo-cli/neo-cli.csproj b/neo-cli/neo-cli.csproj index 8c4c3a68c..ae36d6481 100644 --- a/neo-cli/neo-cli.csproj +++ b/neo-cli/neo-cli.csproj @@ -28,7 +28,7 @@ - +