mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-05-31 22:06:16 -07:00
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:
18
dist/index.js
generated
vendored
18
dist/index.js
generated
vendored
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -30,8 +30,10 @@ export async function loadOrchestrator(): Promise<
|
||||
};
|
||||
},
|
||||
};
|
||||
} catch {
|
||||
// Orchestrator package not installed
|
||||
} catch (error) {
|
||||
if (!isModuleNotFoundError(error)) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +78,20 @@ export async function loadPluginServices() {
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
if (!isModuleNotFoundError(error)) {
|
||||
throw error;
|
||||
}
|
||||
core.warning(`Orchestrator plugin not available: ${(error as Error).message}`);
|
||||
}
|
||||
}
|
||||
|
||||
function isModuleNotFoundError(error: unknown): boolean {
|
||||
if (error && typeof error === 'object' && 'code' in error) {
|
||||
const code = (error as { code: string }).code;
|
||||
if (code === 'MODULE_NOT_FOUND' || code === 'ERR_MODULE_NOT_FOUND') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return typeof (error as Error)?.message === 'string' && /cannot find module/i.test((error as Error).message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user