mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-28 00:56:19 +00:00
Fix RPCError raising an error itself because of non-optional args
This commit is contained in:
parent
82efc9a154
commit
ee2d5b1315
@ -32,12 +32,12 @@ class RPCError(Exception):
|
|||||||
NAME = None
|
NAME = None
|
||||||
MESSAGE = "{x}"
|
MESSAGE = "{x}"
|
||||||
|
|
||||||
def __init__(self, x: int or RawRPCError, rpc_name: str, is_unknown: bool):
|
def __init__(self, x: int or RawRPCError = None, rpc_name: str = None, is_unknown: bool = False):
|
||||||
super().__init__("[{} {}]: {} ({})".format(
|
super().__init__("[{} {}]: {} {}".format(
|
||||||
self.CODE,
|
self.CODE,
|
||||||
self.ID or self.NAME,
|
self.ID or self.NAME,
|
||||||
self.MESSAGE.format(x=x),
|
self.MESSAGE.format(x=x),
|
||||||
'caused by "{}"'.format(rpc_name)
|
'(caused by "{}")'.format(rpc_name) if rpc_name else ""
|
||||||
))
|
))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user