Skip to content

Commit a031d8b

Browse files
committed
refactor(code-index): centralize initialization error state
1 parent bda2159 commit a031d8b

2 files changed

Lines changed: 2 additions & 11 deletions

File tree

src/services/code-index/__tests__/manager.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,15 @@ describe("CodeIndexManager - handleSettingsChange regression", () => {
171171
})
172172

173173
describe("initialize", () => {
174-
it("records initialization failures and rethrows the original error", async () => {
174+
it("rethrows initialization failures without updating lifecycle state", async () => {
175175
const error = new Error("configuration failed")
176176
manager["_configManager"] = {
177177
loadConfiguration: vi.fn().mockRejectedValue(error),
178178
} as never
179179

180180
await expect(manager.initialize({} as never)).rejects.toBe(error)
181181

182-
expect(manager["_stateManager"].setSystemState).toHaveBeenCalledWith("Error", error.message)
182+
expect(manager["_stateManager"].setSystemState).not.toHaveBeenCalled()
183183
})
184184
})
185185

src/services/code-index/manager.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,6 @@ export class CodeIndexManager {
122122
* @returns Object indicating if a restart is needed
123123
*/
124124
public async initialize(contextProxy: ContextProxy): Promise<{ requiresRestart: boolean }> {
125-
try {
126-
return await this.initializeInternal(contextProxy)
127-
} catch (error) {
128-
this._stateManager.setSystemState("Error", error instanceof Error ? error.message : String(error))
129-
throw error
130-
}
131-
}
132-
133-
private async initializeInternal(contextProxy: ContextProxy): Promise<{ requiresRestart: boolean }> {
134125
// 1. ConfigManager Initialization and Configuration Loading
135126
if (!this._configManager) {
136127
this._configManager = new CodeIndexConfigManager(contextProxy)

0 commit comments

Comments
 (0)