Charca / bootbot

Facebook Messenger Bot Framework for Node.js
MIT License
974 stars 253 forks source link

Messenger Error Handling #148

Closed DerekNMartin closed 5 years ago

DerekNMartin commented 6 years ago

How would I go about handling a messenger error? (ex.'(#100) Length of param message[text] must be less than or equal to 2000',)

It seems like there's no way to catch the error since it seems like the response isn't returned, only console logged.

Charca commented 6 years ago

@DerekNMartin the Send API methods return a promise, so you should be able to use a catch statement like:

chat.say('hello world')
  .then(() => console.log('success'))
  .catch(() => console.log('handle error here'))

Is that not working for you?