mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-29 12:53:44 +03:00
Fix creating unknown RPCError messages with known code failing
This commit is contained in:
parent
785ef7676f
commit
c1d67f35c9
|
@ -69,4 +69,4 @@ def rpc_message_to_error(rpc_error, report_method=None):
|
||||||
if cls:
|
if cls:
|
||||||
return cls(rpc_error.error_message)
|
return cls(rpc_error.error_message)
|
||||||
|
|
||||||
return RPCError(rpc_error.error_code, rpc_error.error_message)
|
return RPCError(rpc_error.error_message, rpc_error.error_code)
|
||||||
|
|
|
@ -3,8 +3,8 @@ class RPCError(Exception):
|
||||||
code = None
|
code = None
|
||||||
message = None
|
message = None
|
||||||
|
|
||||||
def __init__(self, code, message):
|
def __init__(self, message, code=None):
|
||||||
super().__init__('RPCError {}: {}'.format(code, message))
|
super().__init__('RPCError {}: {}'.format(code or self.code, message))
|
||||||
self.code = code
|
self.code = code
|
||||||
self.message = message
|
self.message = message
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user