Skip to content

Commit 61953c1

Browse files
authored
'request' may be undefined when handling an error while sending a chat request (microsoft#213869)
Part of microsoft/vscode-copilot#5942
1 parent 8f78098 commit 61953c1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/vs/workbench/contrib/chat/common/chatServiceImpl.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,9 +670,11 @@ export class ChatService extends Disposable implements IChatService {
670670
location
671671
});
672672
const rawResult: IChatAgentResult = { errorDetails: { message: err.message } };
673-
model.setResponse(request, rawResult);
673+
if (request) {
674+
model.setResponse(request, rawResult);
675+
}
674676
completeResponseCreated();
675-
this.trace('sendRequest', `Error while handling request: ${toErrorMessage(err)}`);
677+
this.logService.error(`Error while handling chat request: ${toErrorMessage(err)}`);
676678
model.completeResponse(request);
677679
} finally {
678680
listener.dispose();

0 commit comments

Comments
 (0)