Skip to content

Commit

Permalink
πŸš€ Enhance error handling in PromptHandlers to display error messages …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
nicodecleyre authored Jan 1, 2025
1 parent beaf740 commit e09e726
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/chat/PromptHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,14 @@ export class PromptHandlers {
}
} catch (err: any) {
Logger.getInstance();
Logger.error(err!.error ? err!.error.message.toString() : err.toString());
const errorText = err!.error ? err!.error.message.toString() : err.toString();
Logger.error(errorText);
stream.markdown('\n\nI was not able to retrieve the data from SharePoint. Please check the logs in output window for more information.');

const markdownString = new vscode.MarkdownString();
markdownString.supportHtml = true;
markdownString.appendMarkdown(`<span style="color:#f00;">${errorText}</span>`);
stream.markdown(markdownString);
}
}

Expand Down

0 comments on commit e09e726

Please sign in to comment.