Make TLMessage always have a valid TLObject

This simplifies the flow instead of having separate request/body
attributes, and also means that BinaryReader.tgread_object() can
be used without so many special cases.
This commit is contained in:
Lonami Exo
2018-06-09 13:48:27 +02:00
parent f7e8907c6f
commit be279ce3f5
6 changed files with 98 additions and 91 deletions

View File

@@ -141,7 +141,10 @@ class BinaryReader:
if clazz is None:
# If there was still no luck, give up
self.seek(-4) # Go back
raise TypeNotFoundError(constructor_id)
pos = self.tell_position()
error = TypeNotFoundError(constructor_id, self.read())
self.set_position(pos)
raise error
return clazz.from_reader(self)