mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 17:36:34 +03:00
Show more information for bare RPCError (#919)
This commit is contained in:
parent
f2c8663266
commit
cc4c620261
|
@ -65,5 +65,8 @@ def rpc_message_to_error(rpc_error, report_method=None):
|
|||
capture = int(m.group(1)) if m.groups() else None
|
||||
return cls(capture=capture)
|
||||
|
||||
cls = base_errors.get(rpc_error.error_code, RPCError)
|
||||
return cls(rpc_error.error_message)
|
||||
cls = base_errors.get(rpc_error.error_code)
|
||||
if cls:
|
||||
return cls(rpc_error.error_message)
|
||||
|
||||
return RPCError(rpc_error.error_code, rpc_error.error_message)
|
||||
|
|
|
@ -3,8 +3,13 @@ class RPCError(Exception):
|
|||
code = None
|
||||
message = None
|
||||
|
||||
def __init__(self, code, message):
|
||||
super().__init__('RPCError {}: {}'.format(code, message))
|
||||
self.code = code
|
||||
self.message = message
|
||||
|
||||
def __reduce__(self):
|
||||
return type(self), ()
|
||||
return type(self), (self.code, self.message)
|
||||
|
||||
|
||||
class InvalidDCError(RPCError):
|
||||
|
|
Loading…
Reference in New Issue
Block a user