From 42d8211871d84e2650f7c762c66e2ee2e6c58968 Mon Sep 17 00:00:00 2001 From: V Date: Tue, 13 Jun 2023 02:29:15 +0200 Subject: Fix disabling plugins whose stop() errors --- src/components/PluginSettings/index.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/components/PluginSettings/index.tsx') diff --git a/src/components/PluginSettings/index.tsx b/src/components/PluginSettings/index.tsx index e1b36ef..655eeef 100644 --- a/src/components/PluginSettings/index.tsx +++ b/src/components/PluginSettings/index.tsx @@ -138,11 +138,13 @@ function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, onMouseLe } const result = wasEnabled ? stopPlugin(plugin) : startPlugin(plugin); - const action = wasEnabled ? "stop" : "start"; if (!result) { - logger.error(`Failed to ${action} plugin ${plugin.name}`); - showErrorToast(`Failed to ${action} plugin: ${plugin.name}`); + settings.enabled = false; + + const msg = `Error while ${wasEnabled ? "stopping" : "starting"} plugin ${plugin.name}`; + logger.error(msg); + showErrorToast(msg); return; } -- cgit