mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 09:26:37 +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:
|
||||
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
|
||||
message = None
|
||||
|
||||
def __init__(self, code, message):
|
||||
super().__init__('RPCError {}: {}'.format(code, message))
|
||||
def __init__(self, message, code=None):
|
||||
super().__init__('RPCError {}: {}'.format(code or self.code, message))
|
||||
self.code = code
|
||||
self.message = message
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user