Node-telegram-bot-api: Error handling

Created on 2 May 2016  路  6Comments  路  Source: yagop/node-telegram-bot-api

If you run a bot in polling mode over a longer period of time you can run into many different errors like timeouts and some async/promise problems in bluebird.

My main problem is the error handling. As far as I can see there is no proper solution included in this API. So how do you guys handle and/or catch errors so that the bot doesn鈥檛 crash after a few hrs?

bug

Most helpful comment

Proper Error Handling has been added in v0.27.0. Please see the documentation on error handling.

Thanks @panp858, @PandaWhisperer, @kryptome, @roccomuso and @GermanBluefox for your time, effort and patience while we worked on this feature. :tada:

All 6 comments

Just noticed this as well. Apparently, any exceptions thrown in a message event handler will be silently suppressed.

You can use Forever libraries, so that if your Code throws errors and timeout's then it will restart your bot server.

Watch PR #180 for a possible fix on this issue.

However, your application will not crash on such unhandled exceptions during polling. An error will be logged to your console. What would be your approach in handling such errors?

Proper Error Handling is on our TODO list.

We need to:

  • Be able to handle distinct type of errors
  • Document possible errors that one may encounter, and how to handle them

Related issues:

Proper Error Handling has been added in v0.27.0. Please see the documentation on error handling.

Thanks @panp858, @PandaWhisperer, @kryptome, @roccomuso and @GermanBluefox for your time, effort and patience while we worked on this feature. :tada:

thanks @GochoMugo !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Hostile picture Hostile  路  3Comments

jacopocappelli1989 picture jacopocappelli1989  路  4Comments

mbrammer picture mbrammer  路  3Comments

hems picture hems  路  3Comments

Niquolas picture Niquolas  路  4Comments