depoio / node-telegram-bot

Client wrapper for Telegram Bot API (Under heavy development)
MIT License
136 stars 30 forks source link

Error: Gateway error. #81

Closed vbauer closed 8 years ago

vbauer commented 8 years ago
2016-08-24T11:49:37.598Z - info:  Error: Gateway error.
    at Request._callback (/var/lib/openshift/55a967bc500446e3a9000060/app-root/runtime/repo/node_modules/node-telegram-bot/lib/Bot.js:273:28)
    at Request.self.callback (/var/lib/openshift/55a967bc500446e3a9000060/app-root/runtime/repo/node_modules/node-telegram-bot/node_modules/request/request.js:187:22)
    at Request.emit (events.js:98:17)
    at Request.<anonymous> (/var/lib/openshift/55a967bc500446e3a9000060/app-root/runtime/repo/node_modules/node-telegram-bot/node_modules/request/request.js:1044:10)
    at Request.emit (events.js:95:17)
    at IncomingMessage.<anonymous> (/var/lib/openshift/55a967bc500446e3a9000060/app-root/runtime/repo/node_modules/node-telegram-bot/node_modules/request/request.js:965:12)
    at IncomingMessage.emit (events.js:117:20)
    at _stream_readable.js:944:16
    at process._tickCallback (node.js:442:13)
derhuerst commented 8 years ago

That's Telegrams fault afaik.

vbauer commented 8 years ago

Probably, but is it possible to wrap this exception? In the current moment my bot suddenly breaks.

derhuerst commented 8 years ago

Why would you wrap that error? I think it is your responsibility you properly handle that error.

vbauer commented 8 years ago

I mean this error occurs in the part of node-telegram-bot library. Is it possible to handle somehow this exception in my code?

derhuerst commented 8 years ago

How do you receive the error?

vbauer commented 8 years ago

You can see full stacktrace in the description. That's all I have..

derhuerst commented 8 years ago

Did you get it in a callback or has it been thrown somewhere else?

vbauer commented 8 years ago

If I have got this information, I could catch this error and add some logging, but I do not know how to understand it using this stacktrace.

I see that error occurs somewhere in poll method inside pollingRequest: https://github.com/depoio/node-telegram-bot/blob/master/lib/Bot.js#L273

derhuerst commented 8 years ago

Do something like bot.on('error', (err) => {/* handle error here */).

vbauer commented 8 years ago

Thank you for suggestion, I will try it as soon as possible!

vbauer commented 8 years ago

Hmm.. I've just checked source and I already have the following code (but bot was stopped anyway).

bot.on('error', function (error) {
    log(error);
});

Perhaps the problem was caused by OpenShift. Thank you for your time! I will reopen this ticket, if find something interesting.