Added exception handler to initialize. For some reason CurrentDomain_UnhandledException isn't catching it.
This commit is contained in:
parent
b283fe370d
commit
0801281c91
1 changed files with 80 additions and 71 deletions
|
|
@ -107,6 +107,9 @@ namespace TShockAPI
|
||||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
if (File.Exists(Path.Combine(SavePath, "tshock.pid")))
|
if (File.Exists(Path.Combine(SavePath, "tshock.pid")))
|
||||||
{
|
{
|
||||||
Log.ConsoleInfo("TShock was improperly shut down. Deleting invalid pid file...");
|
Log.ConsoleInfo("TShock was improperly shut down. Deleting invalid pid file...");
|
||||||
|
|
@ -138,7 +141,6 @@ namespace TShockAPI
|
||||||
Config.MySqlUsername,
|
Config.MySqlUsername,
|
||||||
Config.MySqlPassword
|
Config.MySqlPassword
|
||||||
);
|
);
|
||||||
DB.Open();
|
|
||||||
}
|
}
|
||||||
catch (MySqlException ex)
|
catch (MySqlException ex)
|
||||||
{
|
{
|
||||||
|
|
@ -186,6 +188,14 @@ namespace TShockAPI
|
||||||
|
|
||||||
Log.ConsoleInfo("AutoSave " + (Config.AutoSave ? "Enabled" : "Disabled"));
|
Log.ConsoleInfo("AutoSave " + (Config.AutoSave ? "Enabled" : "Disabled"));
|
||||||
Log.ConsoleInfo("Backups " + (Backups.Interval > 0 ? "Enabled" : "Disabled"));
|
Log.ConsoleInfo("Backups " + (Backups.Interval > 0 ? "Enabled" : "Disabled"));
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error("Fatal Startup Exception");
|
||||||
|
Log.Error(ex.ToString());
|
||||||
|
Environment.Exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DeInitialize()
|
public override void DeInitialize()
|
||||||
|
|
@ -240,7 +250,6 @@ namespace TShockAPI
|
||||||
Main.worldPathName += ".crash";
|
Main.worldPathName += ".crash";
|
||||||
WorldGen.saveWorld();
|
WorldGen.saveWorld();
|
||||||
}
|
}
|
||||||
DeInitialize();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue