question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to handle errors

See original GitHub issue

Hello,

I’m currently doing a little project using Telegraf and I have a problems handling errors. I have read a lot about it and I have seen some solutions but they are not working.

The code I am having problems with is basically this one:

const bot = new Telegraf(config.telegram.token);
bot.on('message', (ctx) =>
    process_message(ctx.message, callback)
);

bot.startPolling();

And, for example, when I open another bot I have this problem, very reported: Failed to process updates. { Error: 409: Conflict: terminated by other getUpdates request

I have seen that you can use bot.catch(err => console.log(err)); but it’s not working for me. As I know, Telegraf works with promises, so I also tried bot.startPolling().catch(err => console.log(err));

I’m sorry it this have been answered already, as you can see I did some research but nothing is working because I’m missing something.

Thanks a lot.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:23 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
Piterdencommented, Aug 28, 2018

And what do you want?

3reactions
Piterdencommented, Aug 29, 2018

Why don’t I have it? Maybe it’s your environment issue? Check out things like a firewall and so on…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error monitoring and exception handling in large-scale ...
A solution to handle unhandled exceptions with error monitoring · Do: Prioritize errors/exceptions found on production servers over those found ...
Read more >
4. Error Handling - Open Book Project
In general, one deals with programmer errors by finding and fixing them, and with genuine errors by having the code check for them...
Read more >
What is Error Handling? - Definition from Techopedia
Error handling refers to the response and recovery procedures from error conditions present in a software application. In other words, it is the...
Read more >
How to implement complete error handling? - Codegrip
Try using statements that can make error handling for you. For example, JavaScript has an error-handling statement try..catch..finally. You can use the try ......
Read more >
Eleven tips to Handle Errors that make life Easier as ... - Medium
1.Condition should be truly an exceptional · 2. If possible handle locally · 3. Think about the right level of abstraction · 4....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found