mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Extended exception handler behaviour for async
This commit is contained in:
parent
231371f1f8
commit
572f103db7
@ -421,17 +421,30 @@ class AsyncTeleBot:
|
|||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
except asyncio_helper.ApiTelegramException as e:
|
except asyncio_helper.ApiException as e:
|
||||||
logger.error(str(e))
|
handled = False
|
||||||
if non_stop:
|
if self.exception_handler:
|
||||||
|
self.exception_handler.handle(e)
|
||||||
|
handled = True
|
||||||
|
|
||||||
|
if not handled:
|
||||||
|
logger.debug(traceback.format_exc())
|
||||||
|
|
||||||
|
if non_stop or handled:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
break
|
raise e
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error('Cause exception while getting updates.')
|
handled = False
|
||||||
if non_stop:
|
if self.exception_handler:
|
||||||
logger.error(str(e))
|
self.exception_handler.handle(e)
|
||||||
await asyncio.sleep(3)
|
handled = True
|
||||||
|
|
||||||
|
if not handled:
|
||||||
|
logger.error('Cause exception while getting updates. Enable debug logging for more info.')
|
||||||
|
logger.debug(traceback.format_exc())
|
||||||
|
|
||||||
|
if non_stop or handled:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
raise e
|
raise e
|
||||||
|
Loading…
Reference in New Issue
Block a user