From bc03464da3401d70d44cc0d395e897eb68dd6726 Mon Sep 17 00:00:00 2001 From: Cain Atkinson <19270622+yellowsink@users.noreply.github.com> Date: Sun, 14 May 2023 23:09:37 +0100 Subject: [PATCH] [Plugins] Allow plugins to still load if they fail to update (#85) * [Plugins] allow plugins to load if they fail to update On poor quality networks, plugins can fail to update. This shouldn't mean that they aren't loaded, however. * [Plugins] Log fetch error to Debug Logs not console --------- Co-authored-by: Beef --- src/lib/plugins.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/plugins.ts b/src/lib/plugins.ts index 3891363..09121fe 100644 --- a/src/lib/plugins.ts +++ b/src/lib/plugins.ts @@ -131,7 +131,7 @@ export async function initPlugins() { if (!settings.safeMode?.enabled) { // Loop over any plugin that is enabled, update it if allowed, then start it. - await Promise.allSettled(allIds.filter(pl => plugins[pl].enabled).map(async (pl) => (plugins[pl].update && await fetchPlugin(pl), await startPlugin(pl)))); + await Promise.allSettled(allIds.filter(pl => plugins[pl].enabled).map(async (pl) => (plugins[pl].update && await fetchPlugin(pl).catch((e: Error) => logger.error(e.message)), await startPlugin(pl)))); // Wait for the above to finish, then update all disabled plugins that are allowed to. allIds.filter(pl => !plugins[pl].enabled && plugins[pl].update).forEach(pl => fetchPlugin(pl)); };