@@ -30,11 +30,11 @@ class RPCError(Exception):
3030 ID = None
3131 CODE = None
3232 NAME = None
33- MESSAGE = "{x }"
33+ MESSAGE = "{value }"
3434
3535 def __init__ (
3636 self ,
37- x : Union [int , str , raw .types .RpcError ] = None ,
37+ value : Union [int , str , raw .types .RpcError ] = None ,
3838 rpc_name : str = None ,
3939 is_unknown : bool = False ,
4040 is_signed : bool = False
@@ -43,18 +43,18 @@ def __init__(
4343 "-" if is_signed else "" ,
4444 self .CODE ,
4545 self .ID or self .NAME ,
46- self .MESSAGE .format (x = x ),
46+ self .MESSAGE .format (value = value ),
4747 f'(caused by "{ rpc_name } ")' if rpc_name else ""
4848 ))
4949
5050 try :
51- self .x = int (x )
51+ self .value = int (value )
5252 except (ValueError , TypeError ):
53- self .x = x
53+ self .value = value
5454
5555 if is_unknown :
5656 with open ("unknown_errors.txt" , "a" , encoding = "utf-8" ) as f :
57- f .write (f"{ datetime .now ()} \t { x } \t { rpc_name } \n " )
57+ f .write (f"{ datetime .now ()} \t { value } \t { rpc_name } \n " )
5858
5959 @staticmethod
6060 def raise_it (rpc_error : "raw.types.RpcError" , rpc_type : Type [TLObject ]):
@@ -68,7 +68,7 @@ def raise_it(rpc_error: "raw.types.RpcError", rpc_type: Type[TLObject]):
6868
6969 if error_code not in exceptions :
7070 raise UnknownError (
71- x = f"[{ error_code } { error_message } ]" ,
71+ value = f"[{ error_code } { error_message } ]" ,
7272 rpc_name = rpc_name ,
7373 is_unknown = True ,
7474 is_signed = is_signed
@@ -80,18 +80,18 @@ def raise_it(rpc_error: "raw.types.RpcError", rpc_type: Type[TLObject]):
8080 raise getattr (
8181 import_module ("pyrogram.errors" ),
8282 exceptions [error_code ]["_" ]
83- )(x = f"[{ error_code } { error_message } ]" ,
83+ )(value = f"[{ error_code } { error_message } ]" ,
8484 rpc_name = rpc_name ,
8585 is_unknown = True ,
8686 is_signed = is_signed )
8787
88- x = re .search (r"_(\d+)" , error_message )
89- x = x .group (1 ) if x is not None else x
88+ value = re .search (r"_(\d+)" , error_message )
89+ value = value .group (1 ) if value is not None else value
9090
9191 raise getattr (
9292 import_module ("pyrogram.errors" ),
9393 exceptions [error_code ][error_id ]
94- )(x = x ,
94+ )(value = value ,
9595 rpc_name = rpc_name ,
9696 is_unknown = False ,
9797 is_signed = is_signed )
0 commit comments