Skip to content

Commit

Permalink
Merge pull request #1758 from sassafrastech/warn-no-thread
Browse files Browse the repository at this point in the history
Fail with better error when thread not found
  • Loading branch information
benbrown committed Oct 28, 2019
2 parents 42e6407 + c736b3f commit 235d1e8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/botkit/src/conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,10 @@ export class BotkitConversation<O extends object = {}> extends Dialog<O> {
// 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) {
Expand Down

0 comments on commit 235d1e8

Please sign in to comment.