diff --git a/src/shared/extensions.js b/src/shared/extensions.js index 2fce8f5..81317c5 100644 --- a/src/shared/extensions.js +++ b/src/shared/extensions.js @@ -52,7 +52,8 @@ async function loadExtension(fileName) { const filePath = path.join(extensionsDir, fileName); if (!fs.existsSync(filePath)) { - throw new Error("Extension file does not exist"); + console.warn(`⚠️ Extension not found: ${fileName}`); + return; } try { @@ -65,26 +66,24 @@ async function loadExtension(fileName) { : (ExtensionClass.default ? new ExtensionClass.default() : null); if (!instance) { - throw new Error("Invalid extension export"); + console.warn(`⚠️ Invalid extension: ${fileName}`); + return; } - if ( - instance.type !== "anime-board" && - instance.type !== "book-board" && - instance.type !== "image-board" - ) { - throw new Error(`Invalid extension type: ${instance.type}`); + if (!["anime-board", "book-board", "image-board"].includes(instance.type)) { + console.warn(`⚠️ Invalid extension (${instance.type}): ${fileName}`); + return; } const name = instance.constructor.name; instance.scrape = scrape; extensions.set(name, instance); - console.log(`📦 Installed & Loaded Extension: ${name}`); + console.log(`📦 Installed & loaded: ${name}`); return name; } catch (err) { - throw new Error(`LoadExtension failed: ${err.message}`); + console.warn(`⚠️ Error loading ${fileName}: ${err.message}`); } }