We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 526aaa0 commit 6752af8Copy full SHA for 6752af8
1 file changed
pyrogram/session/session.py
@@ -53,6 +53,12 @@ class Session:
53
PING_INTERVAL = 5
54
STORED_MSG_IDS_MAX_SIZE = 1000 * 2
55
56
+ TRANSPORT_ERRORS = {
57
+ 404: "auth key not found",
58
+ 429: "transport flood",
59
+ 444: "invalid DC"
60
+ }
61
+
62
def __init__(
63
self,
64
client: "pyrogram.Client",
@@ -292,7 +298,12 @@ async def recv_worker(self):
292
298
293
299
if packet is None or len(packet) == 4:
294
300
if packet:
295
- log.warning('Server sent "%s"', Int.read(BytesIO(packet)))
301
+ error_code = -Int.read(BytesIO(packet))
302
303
+ log.warning(
304
+ "Server sent transport error: %s (%s)",
305
+ error_code, Session.TRANSPORT_ERRORS.get(error_code, "unknown error")
306
+ )
296
307
297
308
if self.is_started.is_set():
309
self.loop.create_task(self.restart())
0 commit comments