From a039d183b705181ec4ff90c34786b315a879b7ac Mon Sep 17 00:00:00 2001 From: Beef Date: Sun, 19 Feb 2023 22:35:53 +0000 Subject: [PATCH] [Plugins] Tidy import code --- src/lib/plugins.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lib/plugins.ts b/src/lib/plugins.ts index 19b1ca9..0aa02bc 100644 --- a/src/lib/plugins.ts +++ b/src/lib/plugins.ts @@ -30,13 +30,11 @@ export async function fetchPlugin(id: string) { try { // by polymanifest spec, plugins should always specify their main file, but just in case pluginJs = await (await safeFetch(id + (pluginManifest.main || "index.js"), { cache: "no-store" })).text(); - } catch { - throw new Error(`Failed to fetch JS for ${id}`); - } - - if (pluginJs.length === 0) throw new Error(`Failed to fetch JS for ${id}`); + } catch {} // Empty catch, checked below } + if (!pluginJs && !existingPlugin) throw new Error(`Failed to fetch JS for ${id}`); + plugins[id] = { id: id, manifest: pluginManifest,