Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants