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