Skip to content

Commit e45f2c7

Browse files
authored
fix(amazonq): Wrap repomap LSP call with try catch (#7992)
## Problem ## Solution --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 9b9c384 commit e45f2c7

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

packages/core/src/codewhisperer/util/supplementalContext/crossFileContextUtil.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,19 @@ export async function fetchProjectContext(
202202
target: 'default' | 'codemap' | 'bm25',
203203
languageclient?: LanguageClient
204204
): Promise<CodeWhispererSupplementalContextItem[]> {
205-
if (languageclient) {
206-
const request: GetSupplementalContextParams = {
207-
filePath: editor.document.uri.fsPath,
205+
try {
206+
if (languageclient) {
207+
const request: GetSupplementalContextParams = {
208+
filePath: editor.document.uri.fsPath,
209+
}
210+
const response = await languageclient.sendRequest<SupplementalContextItem[]>(
211+
getSupplementalContextRequestType.method,
212+
request
213+
)
214+
return response as CodeWhispererSupplementalContextItem[]
208215
}
209-
const response = await languageclient.sendRequest<SupplementalContextItem[]>(
210-
getSupplementalContextRequestType.method,
211-
request
212-
)
213-
return response as CodeWhispererSupplementalContextItem[]
216+
} catch (error) {
217+
return []
214218
}
215219
return []
216220
}

0 commit comments

Comments
 (0)