mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-09-18 18:02:51 +03:00
Rollback match case
This commit is contained in:
parent
55d9343d11
commit
38eae1e21a
|
@ -418,21 +418,20 @@ class Sender:
|
||||||
results = self.mtp.deserialize(self._mtp_buffer)
|
results = self.mtp.deserialize(self._mtp_buffer)
|
||||||
|
|
||||||
for result in results:
|
for result in results:
|
||||||
match result:
|
if isinstance(result, Update):
|
||||||
case Update(body=body):
|
self._process_update(result.body)
|
||||||
self._process_update(body)
|
elif isinstance(result, RpcResult):
|
||||||
case RpcResult():
|
self._process_result(result)
|
||||||
self._process_result(result)
|
elif isinstance(result, RpcError):
|
||||||
case RpcError():
|
self._process_error(result)
|
||||||
self._process_error(result)
|
elif isinstance(result, BadMessageError):
|
||||||
case BadMessageError():
|
self._process_bad_message(result)
|
||||||
self._process_bad_message(result)
|
elif isinstance(result, DeserializationFailure):
|
||||||
case DeserializationFailure():
|
self._process_deserialize_error(result)
|
||||||
self._process_deserialize_error(result)
|
else:
|
||||||
case _:
|
raise RuntimeError(
|
||||||
raise RuntimeError(
|
f"unexpected result type {type(result).__name__}: {result}"
|
||||||
f"unexpected result type {type(result).__name__}: {result}"
|
)
|
||||||
)
|
|
||||||
|
|
||||||
def _process_update(self, update: bytes | bytearray | memoryview) -> None:
|
def _process_update(self, update: bytes | bytearray | memoryview) -> None:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user