Closed sebastianarena closed 8 years ago
Would be nice if you can add a extra line to log the specific error object. However, I've commited a workaround here #43
@longstone actually I think the commit you submitted won't fix the problem. The problem is not that statusCode doesn't exist, is that res is undefined. If statusCode is undefined it wouldn't enter the if anyway. I think if (res && ... ) should fix it.
Unfortunately I don't have an error for this. If you manage to emit an error instead of console.log I might be able to track it on the exceptions server.
i've added the line. In my opinion @shernshiou should decid how to handle errors/logging in overall.
@kaminoo @longstone sorry, just got back from busy work. will look into it.
@shernshiou I've downloaded the latest repo and tested 24x7 on dev and found this new problem:
node-telegram-bot/lib/Bot.js:232
self.emit('error', 'Unknow error, '+err.stack);
^
TypeError: Cannot read property 'stack' of null
@kaminoo can you provide more info?
@shernshiou the only extra thing I know is that this ocurred during a reconnection. The problem seems to be related that the self.emit is not checking if err
if actually not null
or undefined
. Reconnections can happen without errors actually. So it must be that.
@kaminoo I need someone to identify the error before I can output more message. As for now, I will put unknown error.
154a302457f4e0657f4947227262d2d642a55fc5
Hi there, me again. I have your library running 24x7 with a couple of bots on a server. Last week I updated to your latest revision and some crashes started to appear. Sure enough are easy to fix. Seems like the response object is null on some cases. Here are two different errors:
First reported issue
TypeError: Cannot read property 'statusCode' of undefined
File "/node_modules/node-telegram-bot/lib/Bot.js", line 203, in Request._callback
} else if(res.statusCode === 401){
File "/node_modules/request/request.js", line 198, in self.callback
self._callback.apply(self, arguments)
File "events.js", line 107, in Request.emit
File "/node_modules/request/request.js", line 877, in Request.onRequestError
self.emit('error', error)
File "events.js", line 107, in ClientRequest.emit
Second reported issue
TypeError: Cannot read property 'statusCode' of undefined
File "/node_modules/node-telegram-bot/lib/Bot.js", line 159, in Request._callback
console.log("Failed to set webhook with code" + res.statusCode);
File "/node_modules/request/request.js", line 198, in self.callback
self._callback.apply(self, arguments)
File "events.js", line 107, in Request.emit
File "/node_modules/request/request.js", line 877, in Request.onRequestError
self.emit('error', error)
File "events.js", line 107, in ClientRequest.emit
Any extra help I can provide, let me know!