Skip to content

Commit

Permalink
Merge pull request microsoft#1041 from microsoft/isidorn/zesty-moose
Browse files Browse the repository at this point in the history
re-throw other errors so they show up in the UI
  • Loading branch information
isidorn authored Jun 3, 2024
2 parents 1071c55 + d5539c0 commit 057c02f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions chat-sample/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 057c02f

Please sign in to comment.