Skip to content

Commit ee2d5b1

Browse files
committed
Fix RPCError raising an error itself because of non-optional args
1 parent 82efc9a commit ee2d5b1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pyrogram/errors/rpc_error.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ class RPCError(Exception):
3232
NAME = None
3333
MESSAGE = "{x}"
3434

35-
def __init__(self, x: int or RawRPCError, rpc_name: str, is_unknown: bool):
36-
super().__init__("[{} {}]: {} ({})".format(
35+
def __init__(self, x: int or RawRPCError = None, rpc_name: str = None, is_unknown: bool = False):
36+
super().__init__("[{} {}]: {} {}".format(
3737
self.CODE,
3838
self.ID or self.NAME,
3939
self.MESSAGE.format(x=x),
40-
'caused by "{}"'.format(rpc_name)
40+
'(caused by "{}")'.format(rpc_name) if rpc_name else ""
4141
))
4242

4343
try:

0 commit comments

Comments
 (0)