Skip to content

Commit 2e8d4c7

Browse files
Merge master into feature/hybridChat
2 parents 50c0363 + 672e95f commit 2e8d4c7

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

packages/amazonq/src/lsp/chat/messages.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,17 @@ export function registerMessageListeners(
306306
languageClient.onRequest<ShowDocumentParams, ShowDocumentResult>(
307307
ShowDocumentRequest.method,
308308
async (params: ShowDocumentParams): Promise<ShowDocumentParams | ResponseError<ShowDocumentResult>> => {
309-
const uri = vscode.Uri.parse(params.uri)
310-
const doc = await vscode.workspace.openTextDocument(uri)
311-
await vscode.window.showTextDocument(doc, { preview: false })
312-
return params
309+
try {
310+
const uri = vscode.Uri.parse(params.uri)
311+
const doc = await vscode.workspace.openTextDocument(uri)
312+
await vscode.window.showTextDocument(doc, { preview: false })
313+
return params
314+
} catch (e) {
315+
return new ResponseError(
316+
LSPErrorCodes.RequestFailed,
317+
`Failed to open document: ${(e as Error).message}`
318+
)
319+
}
313320
}
314321
)
315322

0 commit comments

Comments
 (0)