From d5539c05fc4380fa3ef7a0110571d3759021168b Mon Sep 17 00:00:00 2001 From: isidorn Date: Mon, 3 Jun 2024 15:51:05 +0200 Subject: [PATCH] re-throw other errors so they show up in the UI --- chat-sample/src/extension.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chat-sample/src/extension.ts b/chat-sample/src/extension.ts index da745e58..3325b3ae 100644 --- a/chat-sample/src/extension.ts +++ b/chat-sample/src/extension.ts @@ -134,6 +134,8 @@ export function activate(context: vscode.ExtensionContext) { } catch (err) { if (err instanceof vscode.LanguageModelError) { console.log(err.message, err.code, err.cause) + } else { + throw err; } return; } @@ -176,6 +178,9 @@ function handleError(err: any, stream: vscode.ChatResponseStream): void { if (err.cause instanceof Error && err.cause.message.includes('off_topic')) { stream.markdown(vscode.l10n.t('I\'m sorry, I can only explain computer science concepts.')); } + } else { + // re-throw other errors so they show up in the UI + throw err; } }