Skip to content

Commit a5a5742

Browse files
Copilothotlong
andcommitted
fix: add validation to PluginLoader.replaceService for consistency
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent b6b411e commit a5a5742

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/core/src/plugin-loader.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,12 @@ export class PluginLoader {
251251
/**
252252
* Replace an existing service instance.
253253
* Used by optimization plugins to swap kernel internals.
254+
* @throws Error if service does not exist
254255
*/
255256
replaceService(name: string, service: any): void {
257+
if (!this.hasService(name)) {
258+
throw new Error(`Service '${name}' not found`);
259+
}
256260
this.serviceInstances.set(name, service);
257261
}
258262

0 commit comments

Comments
 (0)