From 41944452ae58d3fd50dcaab5cf052c78463e38bc Mon Sep 17 00:00:00 2001 From: Bernardo Lopes Date: Fri, 31 Mar 2023 16:56:51 -0300 Subject: [PATCH] [Fools23] Add exception handling to the activation of AU plugins. Also changed Hey, Dalamud! to let FoolsManager... manage the exception. --- Dalamud/Fools/FoolsManager.cs | 11 +++++++++-- Dalamud/Fools/Plugins/HeyDalamudPlugin.cs | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Dalamud/Fools/FoolsManager.cs b/Dalamud/Fools/FoolsManager.cs index 6aac3b349..865261f8b 100644 --- a/Dalamud/Fools/FoolsManager.cs +++ b/Dalamud/Fools/FoolsManager.cs @@ -188,8 +188,15 @@ internal class FoolsManager : IDisposable, IServiceType return; } - var pluginInstance = (IFoolsPlugin)Activator.CreateInstance(pluginMetadata.Type); - this.ActivatedPlugins.Add(plugin, pluginInstance); + try + { + var pluginInstance = (IFoolsPlugin)Activator.CreateInstance(pluginMetadata.Type); + this.ActivatedPlugins.Add(plugin, pluginInstance); + } + catch (Exception e) + { + Log.Error(e, "There was an exception while activating plugin {0}", plugin); + } } public void Dispose() diff --git a/Dalamud/Fools/Plugins/HeyDalamudPlugin.cs b/Dalamud/Fools/Plugins/HeyDalamudPlugin.cs index acc4913b1..6279a0e8b 100644 --- a/Dalamud/Fools/Plugins/HeyDalamudPlugin.cs +++ b/Dalamud/Fools/Plugins/HeyDalamudPlugin.cs @@ -77,7 +77,7 @@ public class HeyDalamudPlugin : IFoolsPlugin { Chat.Print(PluginName, "Error", "Could not start voice recognition. Please make sure that you have the American English Windows Language Pack installed."); - Log.Error(ex, "Could not init voice recognition"); + throw new Exception("Could not init voice recognition", ex); } }