fix: only suppress module-not-found errors in plugin loader

Previously both loadOrchestrator() and loadPluginServices() caught all
errors, masking real failures like syntax errors or missing transitive
dependencies. Now only MODULE_NOT_FOUND / ERR_MODULE_NOT_FOUND errors
are suppressed; all other exceptions are rethrown.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
frostebite
2026-03-10 11:34:10 +00:00
parent 25f0a9c9f2
commit c91f9d16ee
3 changed files with 35 additions and 5 deletions
Generated Vendored
+16 -2
View File
@@ -2259,8 +2259,10 @@ async function loadOrchestrator() {
},
};
}
catch {
// Orchestrator package not installed
catch (error) {
if (!isModuleNotFoundError(error)) {
throw error;
}
}
}
exports.loadOrchestrator = loadOrchestrator;
@@ -2300,10 +2302,22 @@ async function loadPluginServices() {
};
}
catch (error) {
if (!isModuleNotFoundError(error)) {
throw error;
}
core.warning(`Orchestrator plugin not available: ${error.message}`);
}
}
exports.loadPluginServices = loadPluginServices;
function isModuleNotFoundError(error) {
if (error && typeof error === 'object' && 'code' in error) {
const code = error.code;
if (code === 'MODULE_NOT_FOUND' || code === 'ERR_MODULE_NOT_FOUND') {
return true;
}
}
return typeof error?.message === 'string' && /cannot find module/i.test(error.message);
}
/***/ }),