Added unhandled exception handler

This commit is contained in:
Noikoio 2017-10-21 13:13:50 -07:00
parent e30b6be5fe
commit 3c69ee48ab

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Text.RegularExpressions;
namespace Noikoio.RegexBot namespace Noikoio.RegexBot
{ {
@ -13,20 +14,19 @@ namespace Noikoio.RegexBot
RegexBot rb = new RegexBot(); RegexBot rb = new RegexBot();
Console.CancelKeyPress += rb.Console_CancelKeyPress; Console.CancelKeyPress += rb.Console_CancelKeyPress;
//AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
rb.Start().GetAwaiter().GetResult(); rb.Start().GetAwaiter().GetResult();
} }
// TODO Re-implement this once the framework allows for it again. private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
//private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) {
//{ var l = Logger.GetLogger("Runtime");
// var l = _logger.SetPrefix("Runtime"); string[] lines = Regex.Split(e.ExceptionObject.ToString(), "\r\n|\r|\n");
// string[] lines = Regex.Split(e.ExceptionObject.ToString(), "\r\n|\r|\n"); foreach (string line in lines)
// foreach (string line in lines) {
// { l(line).Wait();
// l.Log(line).Wait(); }
// } }
//}
} }
} }