Skip to content

Commit ec72330

Browse files
committed
Allow passing a custom error message
1 parent 0bd22e9 commit ec72330

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

pyrogram/api/errors/error.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ class Error(Exception):
3333
MESSAGE = None
3434

3535
def __init__(self, x: int or RpcError = None, query_type: type = None):
36-
super().__init__("[{} {}]: {}".format(self.CODE, self.ID or self.NAME, self.MESSAGE.format(x=x)))
36+
super().__init__("[{} {}]: {}".format(
37+
self.CODE,
38+
self.ID or self.NAME,
39+
str(self) or self.MESSAGE.format(x=x)
40+
))
3741

3842
try:
3943
self.x = int(x)

0 commit comments

Comments
 (0)