Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Fail with better error when thread not found #1758

Merged
merged 2 commits into from
Oct 28, 2019

Conversation

cooperka
Copy link
Contributor

@cooperka cooperka commented Aug 1, 2019

Motivation

I was helping a friend debug a conversation earlier and the error we were getting didn't make any sense. Then we realized the thread name just had a typo in it.

Demo project with errors: comet-spice on Glitch.

Changes

Improves the following error message:

When trying to go to a thread that hasn't been defined, e.g. convo.gotoThread('foo'):

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of undefined
    at BotkitConversation.<anonymous> (node_modules/botkit/lib/conversation.js:523:37)

=>

UnhandledPromiseRejectionWarning: Error: Thread 'foo' not found, did you add any messages to it?
    at BotkitConversation.<anonymous> (node_modules/botkit/lib/conversation.js:466:19)

@benbrown
Copy link
Contributor

benbrown commented Aug 2, 2019

Good change, thanks!

@benbrown benbrown added this to the 4.6 milestone Sep 13, 2019
@benbrown benbrown merged commit 235d1e8 into howdyai:master Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants