error handle

This commit is contained in:
2025-10-11 11:40:41 +08:00
parent 49d7f2c37e
commit 45ec0fd021
8 changed files with 447 additions and 61 deletions

View File

@@ -52,9 +52,10 @@ export class ServiceRegistry {
// 注册基本服务 - 这些服务没有其他依赖
this.registerEventBuilder()
this.registerExternalAppDiscovery()
this.registerResourceService()
this.registerErrorHandler()
// 注册核心服务 - 按照依赖关系顺序注册
this.registerResourceService()
this.registerWindowFormService()
this.registerSandboxEngine()
this.registerLifecycleManager()
@@ -170,8 +171,24 @@ export class ServiceRegistry {
ServiceIds.WINDOW_FORM_SERVICE,
ServiceIds.SANDBOX_ENGINE,
ServiceIds.LIFECYCLE_MANAGER,
ServiceIds.EVENT_BUILDER
ServiceIds.EVENT_BUILDER,
ServiceIds.ERROR_HANDLER
]
)
}
/**
* 注册错误处理服务
*/
private registerErrorHandler(): void {
this.container.register(
ServiceIds.ERROR_HANDLER,
async () => {
// 延迟导入避免循环依赖
const { ErrorHandlerImpl } = await import('../impl/ErrorHandlerImpl')
return new ErrorHandlerImpl()
},
[] // 错误处理服务应尽量减少依赖,避免在错误处理过程中出现循环依赖
)
}
}