ERR_UNHANDLED_ERROR error #45

Open
opened 2018-10-03 09:56:48 +00:00 by arsamigullin · 0 comments
arsamigullin commented 2018-10-03 09:56:48 +00:00 (Migrated from github.com)

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object])
at Bot.emit (events.js:171:17)
at Bot.EventEmitter.emit (domain.js:442:20)
at /root/nodeapp/node_modules/telegram-api/build/functions/poll.js:19:9
at run (/root/nodeapp/node_modules/core-js/modules/es6.promise.js:75:22)
at /root/nodeapp/node_modules/core-js/modules/es6.promise.js:92:30
at flush (/root/nodeapp/node_modules/core-js/modules/_microtask.js:18:9)
at process._tickCallback (internal/process/next_tick.js:61:11)

What I have:
telegram-api : v4.1.0
OS : Ubuntu 16.04.3 x64
Node js : v10.2.1
npm : v6.4.1

The code I use:

var bot = new Bot({
  token: config.botkey
});

bot.on('command-notfound', message => {
  if (message.chat.id > 0) {
    bot.send(new Message().text('Command not found').to(message.chat.id));
  }
});

async function notifyUser(chatId, msg, options) {
  try{
    await bot.send(new Message().text(msg).to(chatId));
    logger.info('test was sent');
  } catch(ex){
    logger.error('error wile sending : ' + JSON.stringify(ex))
  }
}

bot.start();
Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object]) at Bot.emit (events.js:171:17) at Bot.EventEmitter.emit (domain.js:442:20) at /root/nodeapp/node_modules/telegram-api/build/functions/poll.js:19:9 at run (/root/nodeapp/node_modules/core-js/modules/es6.promise.js:75:22) at /root/nodeapp/node_modules/core-js/modules/es6.promise.js:92:30 at flush (/root/nodeapp/node_modules/core-js/modules/_microtask.js:18:9) at process._tickCallback (internal/process/next_tick.js:61:11) **What I have:** telegram-api : v4.1.0 OS : Ubuntu 16.04.3 x64 Node js : v10.2.1 npm : v6.4.1 **The code I use:** ``` var bot = new Bot({ token: config.botkey }); bot.on('command-notfound', message => { if (message.chat.id > 0) { bot.send(new Message().text('Command not found').to(message.chat.id)); } }); async function notifyUser(chatId, msg, options) { try{ await bot.send(new Message().text(msg).to(chatId)); logger.info('test was sent'); } catch(ex){ logger.error('error wile sending : ' + JSON.stringify(ex)) } } bot.start(); ```
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: thereadme/node-telegram-api#45
No description provided.