From bec2ad6847137fafff350393ce2ce45ff1ab6f11 Mon Sep 17 00:00:00 2001 From: John Taylor Date: Wed, 1 May 2019 11:31:50 -0700 Subject: [PATCH 1/2] warning message and order of state trace --- libraries/botbuilder/src/inspectionMiddleware.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/botbuilder/src/inspectionMiddleware.ts b/libraries/botbuilder/src/inspectionMiddleware.ts index 799753d237..057cd43bd2 100644 --- a/libraries/botbuilder/src/inspectionMiddleware.ts +++ b/libraries/botbuilder/src/inspectionMiddleware.ts @@ -102,8 +102,6 @@ abstract class InterceptionMiddleware implements Middleware { await this.invokeOutbound(ctx, [ traceActivity ]); return await nextDelete(); }); - - await this.invokeTraceState(turnContext); } if (shouldForwardToApplication) { @@ -116,6 +114,11 @@ abstract class InterceptionMiddleware implements Middleware { throw err; } } + + if (shouldIntercept) { + + await this.invokeTraceState(turnContext); + } } protected abstract inbound(turnContext: TurnContext, traceActivity: Partial): Promise; @@ -358,6 +361,7 @@ class InspectionSession { try { await this.connectorClient.conversations.sendToConversation(activity.conversation.id, activity as Activity); } catch (err) { + console.warn('Exception while attempting to call emulator for inspection, check it is running, and you have correct credentials in the Emulator and the inspectionMiddleware.'); return false; } From c23a29fa4378a5d6acb47711d6aa9d3751fa79d2 Mon Sep 17 00:00:00 2001 From: John Taylor Date: Wed, 1 May 2019 11:42:43 -0700 Subject: [PATCH 2/2] improve error message --- libraries/botbuilder/src/inspectionMiddleware.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/botbuilder/src/inspectionMiddleware.ts b/libraries/botbuilder/src/inspectionMiddleware.ts index 057cd43bd2..1087982960 100644 --- a/libraries/botbuilder/src/inspectionMiddleware.ts +++ b/libraries/botbuilder/src/inspectionMiddleware.ts @@ -361,7 +361,7 @@ class InspectionSession { try { await this.connectorClient.conversations.sendToConversation(activity.conversation.id, activity as Activity); } catch (err) { - console.warn('Exception while attempting to call emulator for inspection, check it is running, and you have correct credentials in the Emulator and the inspectionMiddleware.'); + console.warn(`Exception '${ err }' while attempting to call Emulator for inspection, check it is running, and you have correct credentials in the Emulator and the InspectionMiddleware.`); return false; }