mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 17:36:34 +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,9 +610,14 @@ class MTProtoSender:
|
||||||
if not state.future.cancelled():
|
if not state.future.cancelled():
|
||||||
state.future.set_exception(error)
|
state.future.set_exception(error)
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
with BinaryReader(rpc_result.body) as reader:
|
with BinaryReader(rpc_result.body) as reader:
|
||||||
result = state.request.read_result(reader)
|
result = state.request.read_result(reader)
|
||||||
|
except Exception as e:
|
||||||
|
# e.g. TypeNotFoundError, should be propagated to caller
|
||||||
|
if not state.future.cancelled():
|
||||||
|
state.future.set_exception(e)
|
||||||
|
else:
|
||||||
if not state.future.cancelled():
|
if not state.future.cancelled():
|
||||||
state.future.set_result(result)
|
state.future.set_result(result)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user