Skip to content

Commit e7c1933

Browse files
authored
fix(codewhisperer): error type is swallowed #3876
1 parent cb5cc21 commit e7c1933

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

src/codewhisperer/service/recommendationHandler.ts

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -108,31 +108,23 @@ export class RecommendationHandler {
108108
promise: Promise<any>
109109
): Promise<any> {
110110
const timeoutMessage = isCloud9() ? `Generate recommendation timeout.` : `List recommendation timeout`
111-
try {
112-
if (isManualTriggerOn && triggerType === 'OnDemand' && (isCloud9() || isFirstPaginationCall)) {
113-
return vscode.window.withProgress(
114-
{
115-
location: vscode.ProgressLocation.Notification,
116-
title: CodeWhispererConstants.pendingResponse,
117-
cancellable: false,
118-
},
119-
async () => {
120-
return await asyncCallWithTimeout(
121-
promise,
122-
timeoutMessage,
123-
CodeWhispererConstants.promiseTimeoutLimit * 1000
124-
)
125-
}
126-
)
127-
}
128-
return await asyncCallWithTimeout(
129-
promise,
130-
timeoutMessage,
131-
CodeWhispererConstants.promiseTimeoutLimit * 1000
111+
if (isManualTriggerOn && triggerType === 'OnDemand' && (isCloud9() || isFirstPaginationCall)) {
112+
return vscode.window.withProgress(
113+
{
114+
location: vscode.ProgressLocation.Notification,
115+
title: CodeWhispererConstants.pendingResponse,
116+
cancellable: false,
117+
},
118+
async () => {
119+
return await asyncCallWithTimeout(
120+
promise,
121+
timeoutMessage,
122+
CodeWhispererConstants.promiseTimeoutLimit * 1000
123+
)
124+
}
132125
)
133-
} catch (error) {
134-
throw new Error(`${error instanceof Error ? error.message : error}`)
135126
}
127+
return await asyncCallWithTimeout(promise, timeoutMessage, CodeWhispererConstants.promiseTimeoutLimit * 1000)
136128
}
137129

138130
async getTaskTypeFromEditorFileName(filePath: string): Promise<CodewhispererGettingStartedTask | undefined> {

0 commit comments

Comments
 (0)