The best way to handle exception #52
Unanswered
FebriPratama
asked this question in
Q&A
Replies: 1 comment
-
|
Hello. Mmm, i think a try-catch inside your while statement should be enough for exceptions handling during getting updates. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello
Im using longpolling to get messages,
net core 3.1
Telegram.BotAPI version 6.6.1
public void StartPolling() { var updates = Bot.GetUpdates<IEnumerable<Update>>(); while (true) { if (updates.Any()) { foreach (var update in updates) { var botInstance = new SidomarBotService(_Token, _configuration); botInstance.OnUpdate(update); } var offset = updates.Last().UpdateId + 1; updates = Bot.GetUpdates<IEnumerable<Update>>(offset); } else { updates = Bot.GetUpdates<IEnumerable<Update>>(); } } }Whats the best way to handle exception throws by startpolling error such as :
Beta Was this translation helpful? Give feedback.
All reactions