mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-09 05:19:41 +00:00
Shield self.disconnected and log RpcCallFail
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import asyncio
|
||||
import itertools
|
||||
import logging
|
||||
import time
|
||||
|
||||
from .telegrambaseclient import TelegramBaseClient
|
||||
from .. import errors, utils
|
||||
from ..tl import TLObject, TLRequest, types, functions
|
||||
|
||||
|
||||
__log__ = logging.getLogger(__name__)
|
||||
_NOT_A_REQUEST = TypeError('You can only invoke requests, not types!')
|
||||
|
||||
|
||||
@@ -28,10 +29,12 @@ class UserMethods(TelegramBaseClient):
|
||||
return results
|
||||
else:
|
||||
return await future
|
||||
except (errors.ServerError, errors.RpcCallFailError):
|
||||
pass
|
||||
except (errors.ServerError, errors.RpcCallFailError) as e:
|
||||
__log__.warning('Telegram is having internal issues %s: %s',
|
||||
e.__class__.__name__, e)
|
||||
except (errors.FloodWaitError, errors.FloodTestPhoneWaitError) as e:
|
||||
if e.seconds <= self.session.flood_sleep_threshold:
|
||||
__log__.info('Sleeping for %ds on flood wait', e.seconds)
|
||||
await asyncio.sleep(e.seconds, loop=self._loop)
|
||||
else:
|
||||
raise
|
||||
|
Reference in New Issue
Block a user