From d501b66f937cb86fb5cd02c122bc136b70114c33 Mon Sep 17 00:00:00 2001 From: shriMADhav U k Date: Thu, 20 Jun 2024 06:59:16 +0200 Subject: [PATCH] Add unknown_errors Improve error messages. Signed-off-by: wulan17 --- compiler/errors/source/400_BAD_REQUEST.tsv | 3 +++ pyrogram/errors/rpc_error.py | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/compiler/errors/source/400_BAD_REQUEST.tsv b/compiler/errors/source/400_BAD_REQUEST.tsv index 1160f811..c50f39a8 100644 --- a/compiler/errors/source/400_BAD_REQUEST.tsv +++ b/compiler/errors/source/400_BAD_REQUEST.tsv @@ -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 diff --git a/pyrogram/errors/rpc_error.py b/pyrogram/errors/rpc_error.py index 295b89af..ab3845e8 100644 --- a/pyrogram/errors/rpc_error.py +++ b/pyrogram/errors/rpc_error.py @@ -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: