fix: add try/catch and error logging for all tiers

This commit is contained in:
goat 2021-04-28 21:02:30 +02:00
parent 411cf3ee9c
commit e84cd7f0be
No known key found for this signature in database
GPG key ID: F18F057873895461

View file

@ -189,7 +189,12 @@ namespace Dalamud
/// </summary> /// </summary>
internal DirectoryInfo AssetDirectory => new DirectoryInfo(this.StartInfo.AssetDirectory); internal DirectoryInfo AssetDirectory => new DirectoryInfo(this.StartInfo.AssetDirectory);
/// <summary>
/// Runs tier 1 of the Dalamud initialization process.
/// </summary>
public void LoadTier1() public void LoadTier1()
{
try
{ {
// Initialize the process information. // Initialize the process information.
this.TargetModule = Process.GetCurrentProcess().MainModule; this.TargetModule = Process.GetCurrentProcess().MainModule;
@ -203,9 +208,15 @@ namespace Dalamud
this.Framework.Enable(); this.Framework.Enable();
Log.Information("[T1] Framework ENABLE!"); Log.Information("[T1] Framework ENABLE!");
} }
catch (Exception ex)
{
Log.Error(ex, "Tier 1 load failed.");
this.Unload();
}
}
/// <summary> /// <summary>
/// Start and initialize Dalamud subsystems. /// Runs tier 2 of the Dalamud initialization process.
/// </summary> /// </summary>
public void LoadTier2() public void LoadTier2()
{ {
@ -296,15 +307,17 @@ namespace Dalamud
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex, "Dalamud::LoadTier2() failed."); Log.Error(ex, "Tier 2 load failed.");
this.Unload(); this.Unload();
} }
} }
/// <summary> /// <summary>
/// Loads the plugin manager and repository. /// Runs tier 3 of the Dalamud initialization process.
/// </summary> /// </summary>
public void LoadTier3() public void LoadTier3()
{
try
{ {
Log.Information("[T3] START!"); Log.Information("[T3] START!");
@ -346,6 +359,12 @@ namespace Dalamud
Log.Information("Dalamud is ready."); Log.Information("Dalamud is ready.");
} }
catch (Exception ex)
{
Log.Error(ex, "Tier 3 load failed.");
this.Unload();
}
}
/// <summary> /// <summary>
/// Queue an unload of Dalamud when it gets the chance. /// Queue an unload of Dalamud when it gets the chance.