Skip to content

Commit

Permalink
Merge pull request #58 from PandaHexCode/main
Browse files Browse the repository at this point in the history
Improved Ouput.log, added UnhandledExceptionHandler
  • Loading branch information
shibbo authored Nov 11, 2023
2 parents 285165c + 122e540 commit e3c06d9
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Fushigi/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Fushigi.util;
using Fushigi.util;
using Fushigi.param;
using Fushigi.ui;

Expand All @@ -8,6 +8,8 @@
Console.SetOut(consoleWriter);
Console.SetError(consoleWriter);

AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;

Console.WriteLine("Starting Fushigi v0.5...");
Console.WriteLine("Loading user settings...");
UserSettings.Load();
Expand All @@ -18,4 +20,16 @@

MainWindow window = new MainWindow();

outputStream.Close();
outputStream.Close();

void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e)
{
Exception? ex = e.ExceptionObject as Exception;
if (ex != null)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex.StackTrace);
}

Environment.Exit(1);
}

0 comments on commit e3c06d9

Please sign in to comment.