From 1080252504e6fc6c331dd4d686ca6f4026bb7837 Mon Sep 17 00:00:00 2001 From: Kevin Cooper Date: Thu, 1 Aug 2019 15:18:53 -0700 Subject: [PATCH] Fail with better error when thread not found --- packages/botkit/src/conversation.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/botkit/src/conversation.ts b/packages/botkit/src/conversation.ts index 0450f7198..3cde0277a 100644 --- a/packages/botkit/src/conversation.ts +++ b/packages/botkit/src/conversation.ts @@ -574,6 +574,10 @@ export class BotkitConversation extends Dialog { // Let's interpret the current line of the script. const thread = this.script[step.thread]; + if (!thread) { + throw new Error(`Thread '${step.thread}' not found, did you add any messages to it?`) + } + // Capture the previous step value if there previous line included a prompt var previous = (step.index >= 1) ? thread[step.index - 1] : null; if (step.result && previous && previous.collect) {