Skip to content

Commit e09e726

Browse files
authored
🚀 Enhance error handling in PromptHandlers to display error messages in red markdown (#382)
## 🎯 Aim Adding the errormessage as output in the chat response ## 📷 Result ![image](https://github.com/user-attachments/assets/53840707-ad7e-4128-984f-76a425af9b98) ## ✅ What was done - [X] Added error response in red markdown to `PromptHandlers` ## 🔗 Related issue Closes: #376
1 parent beaf740 commit e09e726

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎src/chat/PromptHandlers.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,14 @@ export class PromptHandlers {
6666
}
6767
} catch (err: any) {
6868
Logger.getInstance();
69-
Logger.error(err!.error ? err!.error.message.toString() : err.toString());
69+
const errorText = err!.error ? err!.error.message.toString() : err.toString();
70+
Logger.error(errorText);
7071
stream.markdown('\n\nI was not able to retrieve the data from SharePoint. Please check the logs in output window for more information.');
72+
73+
const markdownString = new vscode.MarkdownString();
74+
markdownString.supportHtml = true;
75+
markdownString.appendMarkdown(`<span style="color:#f00;">${errorText}</span>`);
76+
stream.markdown(markdownString);
7177
}
7278
}
7379

0 commit comments

Comments
 (0)