mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +03:00
Fix TypeNotFoundError was not being propagated
Closes #1697. This would cause deadlocks, as the request future would never be resolved, so await would wait forever.
This commit is contained in:
parent
845fe88451
commit
8f0de3d285
|
@ -610,11 +610,16 @@ class MTProtoSender:
|
||||||
if not state.future.cancelled():
|
if not state.future.cancelled():
|
||||||
state.future.set_exception(error)
|
state.future.set_exception(error)
|
||||||
else:
|
else:
|
||||||
with BinaryReader(rpc_result.body) as reader:
|
try:
|
||||||
result = state.request.read_result(reader)
|
with BinaryReader(rpc_result.body) as reader:
|
||||||
|
result = state.request.read_result(reader)
|
||||||
if not state.future.cancelled():
|
except Exception as e:
|
||||||
state.future.set_result(result)
|
# e.g. TypeNotFoundError, should be propagated to caller
|
||||||
|
if not state.future.cancelled():
|
||||||
|
state.future.set_exception(e)
|
||||||
|
else:
|
||||||
|
if not state.future.cancelled():
|
||||||
|
state.future.set_result(result)
|
||||||
|
|
||||||
async def _handle_container(self, message):
|
async def _handle_container(self, message):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user