Added unhandled exception handler
This commit is contained in:
parent
e30b6be5fe
commit
3c69ee48ab
1 changed files with 12 additions and 12 deletions
24
Program.cs
24
Program.cs
|
@ -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();
|
}
|
||||||
// }
|
}
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue