re-throw other errors so they show up in the UI

This commit is contained in:
isidorn
2024-06-03 15:51:05 +02:00
parent 1071c55258
commit d5539c05fc

View File

@ -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;
}
}