mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-14 20:16:48 -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:
+16
-2
@@ -2259,8 +2259,10 @@ async function loadOrchestrator() {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
catch {
|
catch (error) {
|
||||||
// Orchestrator package not installed
|
if (!isModuleNotFoundError(error)) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.loadOrchestrator = loadOrchestrator;
|
exports.loadOrchestrator = loadOrchestrator;
|
||||||
@@ -2300,10 +2302,22 @@ async function loadPluginServices() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
if (!isModuleNotFoundError(error)) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
core.warning(`Orchestrator plugin not available: ${error.message}`);
|
core.warning(`Orchestrator plugin not available: ${error.message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.loadPluginServices = loadPluginServices;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -30,8 +30,10 @@ export async function loadOrchestrator(): Promise<
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
} catch {
|
} catch (error) {
|
||||||
// Orchestrator package not installed
|
if (!isModuleNotFoundError(error)) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,6 +78,20 @@ export async function loadPluginServices() {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
if (!isModuleNotFoundError(error)) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
core.warning(`Orchestrator plugin not available: ${(error as Error).message}`);
|
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