error handle
This commit is contained in:
@@ -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()
|
||||
},
|
||||
[] // 错误处理服务应尽量减少依赖,避免在错误处理过程中出现循环依赖
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user