mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-18 19:16:43 +00:00
Improve error logging in Encrypted class; specify failure reasons for unpacking, deserialization, and decompression
This commit is contained in:
parent
bf4560a8c1
commit
8bcc3aa8b8
@ -246,10 +246,10 @@ class Encrypted(Mtp):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
inner_constructor = struct.unpack_from("<I", result)[0]
|
inner_constructor = struct.unpack_from("<I", result)[0]
|
||||||
except struct.error as e:
|
except struct.error:
|
||||||
# If the result is empty, we can't unpack it.
|
# If the result is empty, we can't unpack it.
|
||||||
# This can happen if the server returns an empty response.
|
# This can happen if the server returns an empty response.
|
||||||
logging.exception(e)
|
logging.exception("Failed to unpack inner_constructor")
|
||||||
self._deserialization.append(
|
self._deserialization.append(
|
||||||
DeserializationFailure(
|
DeserializationFailure(
|
||||||
msg_id=msg_id,
|
msg_id=msg_id,
|
||||||
@ -265,8 +265,8 @@ class Encrypted(Mtp):
|
|||||||
)
|
)
|
||||||
error.msg_id = msg_id
|
error.msg_id = msg_id
|
||||||
self._deserialization.append(error)
|
self._deserialization.append(error)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
logging.exception(e)
|
logging.exception("Failed to deserialize error")
|
||||||
self._deserialization.append(
|
self._deserialization.append(
|
||||||
DeserializationFailure(
|
DeserializationFailure(
|
||||||
msg_id=msg_id,
|
msg_id=msg_id,
|
||||||
@ -286,8 +286,8 @@ class Encrypted(Mtp):
|
|||||||
body = gzip_decompress(GzipPacked.from_bytes(result))
|
body = gzip_decompress(GzipPacked.from_bytes(result))
|
||||||
self._store_own_updates(body)
|
self._store_own_updates(body)
|
||||||
self._deserialization.append(RpcResult(msg_id, body))
|
self._deserialization.append(RpcResult(msg_id, body))
|
||||||
except Exception as e:
|
except Exception:
|
||||||
logging.exception(e)
|
logging.exception("Failed to decompress response")
|
||||||
self._deserialization.append(
|
self._deserialization.append(
|
||||||
DeserializationFailure(msg_id=msg_id, error=DecompressionFailed())
|
DeserializationFailure(msg_id=msg_id, error=DecompressionFailed())
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user