Better error message in case of empty data in buffer

This commit is contained in:
Dan 2021-04-26 16:09:39 +02:00
parent c13230cb81
commit e4f99df07c

View File

@ -63,6 +63,9 @@ def unpack(b: BytesIO, session_id: bytes, auth_key: bytes, auth_key_id: bytes) -
try: try:
message = Message.read(data) message = Message.read(data)
except KeyError as e: except KeyError as e:
if e.args[0] == 0:
raise ConnectionError(f"Received empty data. Check your internet connection.")
left = data.read().hex() left = data.read().hex()
left = [left[i:i + 64] for i in range(0, len(left), 64)] left = [left[i:i + 64] for i in range(0, len(left), 64)]