Add unknown_errors

Improve error messages.

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
shriMADhav U k 2024-06-20 06:59:16 +02:00 committed by wulan17
parent 8fa49a9c43
commit d501b66f93
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5
2 changed files with 7 additions and 3 deletions

View file

@ -63,6 +63,8 @@ CHANNEL_PARICIPANT_MISSING The current user is not in the channel
CHANNEL_PRIVATE The channel/supergroup is not accessible
CHANNEL_TOO_BIG The channel too big
CHANNEL_TOO_LARGE The channel is too large
CHARGE_ALREADY_REFUNDED The charge id was already used for a refund.
CHARGE_NOT_FOUND The charge id was not found.
CHAT_ABOUT_NOT_MODIFIED The chat about text was not modified because you tried to edit it using the same content
CHAT_ABOUT_TOO_LONG The chat about text is too long
CHAT_ADMIN_REQUIRED The method requires chat admin privileges
@ -154,6 +156,7 @@ FILTER_TITLE_EMPTY The title field of the filter is empty
FIRSTNAME_INVALID The first name is invalid
FOLDER_ID_EMPTY The folder you tried to delete was already empty
FOLDER_ID_INVALID The folder id is invalid
FORM_ID_EXPIRED The specified id has expired.
FRESH_CHANGE_ADMINS_FORBIDDEN You can't change administrator settings in this chat because your session was logged-in recently
FROM_MESSAGE_BOT_DISABLED Bots can't use fromMessage min constructors
FROM_PEER_INVALID The from peer value is invalid

1 id message
63 CHANNEL_PRIVATE The channel/supergroup is not accessible
64 CHANNEL_TOO_BIG The channel too big
65 CHANNEL_TOO_LARGE The channel is too large
66 CHARGE_ALREADY_REFUNDED The charge id was already used for a refund.
67 CHARGE_NOT_FOUND The charge id was not found.
68 CHAT_ABOUT_NOT_MODIFIED The chat about text was not modified because you tried to edit it using the same content
69 CHAT_ABOUT_TOO_LONG The chat about text is too long
70 CHAT_ADMIN_REQUIRED The method requires chat admin privileges
156 FIRSTNAME_INVALID The first name is invalid
157 FOLDER_ID_EMPTY The folder you tried to delete was already empty
158 FOLDER_ID_INVALID The folder id is invalid
159 FORM_ID_EXPIRED The specified id has expired.
160 FRESH_CHANGE_ADMINS_FORBIDDEN You can't change administrator settings in this chat because your session was logged-in recently
161 FROM_MESSAGE_BOT_DISABLED Bots can't use fromMessage min constructors
162 FROM_PEER_INVALID The from peer value is invalid

View file

@ -22,7 +22,7 @@ from datetime import datetime
from importlib import import_module
from typing import Type, Union
from pyrogram import raw
from pyrogram import __version__, raw
from pyrogram.raw.core import TLObject
from .exceptions.all import exceptions
@ -40,12 +40,13 @@ class RPCError(Exception):
is_unknown: bool = False,
is_signed: bool = False
):
super().__init__("Telegram says: [{}{} {}] - {} {}".format(
super().__init__("Telegram says: [{}{} {}] {} Pyrogram {} thinks: {}".format(
"-" if is_signed else "",
self.CODE,
self.ID or self.NAME,
f'(caused by "{rpc_name}")' if rpc_name else "",
__version__,
self.MESSAGE.format(value=value),
f'(caused by "{rpc_name}")' if rpc_name else ""
))
try: