Fix misleading error label for Finished handlers (#1329)

BaseChainloader.Execute invoked the Finished event inside the same
try/catch that reports plugin-loading failures, so an exception thrown
by a Finished event listener was logged as "Error occurred loading
plugins:" even though it was unrelated to plugin loading.

Move Finished?.Invoke() into its own try/catch with an accurate
message. Control flow is otherwise unchanged: Finished still runs only
after LoadPlugins succeeds, a throwing listener is still caught, and
"Chainloader startup complete" is still logged afterwards.

Fixes #842
This commit is contained in:
HetCreep authored and GitHub committed 2026-06-08 14:49:39 +02:00
1 parent 77d438cf69
commit f568f0e7b5
1 file changed
+9 -1
+9 -1
View File
@@ -315,7 +315,15 @@ public abstract class BaseChainloader<TPlugin>
var plugins = DiscoverPlugins();
Logger.Log(LogLevel.Info, $"{plugins.Count} plugin{(plugins.Count == 1 ? "" : "s")} to load");
LoadPlugins(plugins);
Finished?.Invoke();
try
{
Finished?.Invoke();
}
catch (Exception ex)
{
Logger.Log(LogLevel.Error, $"Error occurred in a Chainloader.Finished event handler: {ex}");
}
}
catch (Exception ex)
{