Skip to content

Commit 7de86f0

Browse files
authored
fix: wrap load chats on ready in try-catch (#1289)
Problem Currently when the chat loads up a UI ready event is sent to the lsp, to load up previous chats and start indexing. If loading of previous chats fail, the LSP process crashes. This is particularly evident when openTab event has not been handled by the client. An error in that flow should not crash the LSP process or block the rest of the indexing from continuing. Solution This change surrounds the load chat logic within a try catch of its own to allow the rest of the indexing logic to proceed and not crash the server process
1 parent e983bfe commit 7de86f0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,7 @@ export class AgenticChatController implements ChatHandlers {
18091809
onLinkClick() {}
18101810

18111811
async onReady() {
1812-
await this.#tabBarController.loadChats()
1812+
await this.restorePreviousChats()
18131813
try {
18141814
const localProjectContextController = await LocalProjectContextController.getInstance()
18151815
const contextItems = await localProjectContextController.getContextCommandItems()
@@ -2197,6 +2197,14 @@ export class AgenticChatController implements ChatHandlers {
21972197
return tools
21982198
}
21992199

2200+
async restorePreviousChats() {
2201+
try {
2202+
await this.#tabBarController.loadChats()
2203+
} catch (error) {
2204+
this.#log('Error restoring previous chats: ' + error)
2205+
}
2206+
}
2207+
22002208
#createDeferred() {
22012209
let resolve
22022210
let reject

0 commit comments

Comments
 (0)