Skip to content

Commit

Permalink
Merge pull request #2024 from TheWCKD/master
Browse files Browse the repository at this point in the history
added posibility to handle exception on RequestTimeout
  • Loading branch information
coder2020official authored Aug 19, 2023
2 parents e10517e + ebfbfb2 commit 396d476
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions telebot/async_telebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,16 @@ async def _process_polling(self, non_stop: bool=False, interval: int=0, timeout:
except asyncio.CancelledError:
return
except asyncio_helper.RequestTimeout as e:
logger.error(str(e))
if non_stop:
handled = False
if self.exception_handler:
self.exception_handler.handle(e)
handled = True

if not handled:
logger.error('Unhandled exception (full traceback for debug level): %s', str(e))
logger.debug(traceback.format_exc())

if non_stop or handled:
await asyncio.sleep(2)
continue
else:
Expand Down

0 comments on commit 396d476

Please sign in to comment.