mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-01-25 00:34:19 +03:00
Better logging for packing errors
https://github.com/expectocode/telegram-export/issues/76
This commit is contained in:
parent
e3bf6e3330
commit
d3efc8f57d
|
@ -1,10 +1,13 @@
|
|||
import asyncio
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from .gzippacked import GzipPacked
|
||||
from .. import TLObject
|
||||
from ..functions import InvokeAfterMsgRequest
|
||||
|
||||
__log__ = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TLMessage(TLObject):
|
||||
"""
|
||||
|
@ -48,11 +51,17 @@ class TLMessage(TLObject):
|
|||
if not out:
|
||||
self._body = struct.pack('<qi', msg_id, seq_no)
|
||||
else:
|
||||
if self.after_id is None:
|
||||
body = GzipPacked.gzip_if_smaller(self.obj)
|
||||
else:
|
||||
body = GzipPacked.gzip_if_smaller(
|
||||
InvokeAfterMsgRequest(self.after_id, self.obj))
|
||||
try:
|
||||
if self.after_id is None:
|
||||
body = GzipPacked.gzip_if_smaller(self.obj)
|
||||
else:
|
||||
body = GzipPacked.gzip_if_smaller(
|
||||
InvokeAfterMsgRequest(self.after_id, self.obj))
|
||||
except Exception:
|
||||
# struct.pack doesn't give a lot of information about
|
||||
# why it may fail so log the exception AND the object
|
||||
__log__.exception('Failed to pack %s', self.obj)
|
||||
raise
|
||||
|
||||
self._body = struct.pack('<qii', msg_id, seq_no, len(body)) + body
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user