@microsoft/teamsfx 2.3.1-beta.2024012307.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm2017.mjs
CHANGED
@@ -4992,11 +4992,14 @@ class ConversationBot {
|
|
4992
4992
|
adapter.onTurnError = async (context, error) => {
|
4993
4993
|
// This check writes out errors to console.
|
4994
4994
|
console.error(`[onTurnError] unhandled error`, error);
|
4995
|
-
//
|
4996
|
-
|
4997
|
-
|
4998
|
-
|
4999
|
-
|
4995
|
+
// Only send error message for user messages, not for other message types so the bot doesn't spam a channel or chat.
|
4996
|
+
if (context.activity.type === "message") {
|
4997
|
+
// Send a trace activity, which will be displayed in Bot Framework Emulator
|
4998
|
+
await context.sendTraceActivity("OnTurnError Trace", error instanceof Error ? error.message : error, "https://www.botframework.com/schemas/error", "TurnError");
|
4999
|
+
// Send a message to the user
|
5000
|
+
await context.sendActivity(`The bot encountered unhandled error: ${error.message}`);
|
5001
|
+
await context.sendActivity("To continue to run this bot, please fix the bot source code.");
|
5002
|
+
}
|
5000
5003
|
};
|
5001
5004
|
return adapter;
|
5002
5005
|
}
|