From dcbfef0781135e6e04ed6d121dc288c76b572289 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 19 Jun 2024 20:10:33 +0200 Subject: [PATCH] Bump RPC error descriptions --- docs | 2 +- src/RPCError/ChatForbiddenError.php | 4 ++-- src/RPCError/FileTokenInvalidError.php | 4 ++-- src/RPCErrorException.php | 26 +++++++++----------------- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/docs b/docs index 8a319f464..5741538c1 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 8a319f4642fc699965833ac98f270ff92bccc9ee +Subproject commit 5741538c101d6bad5393055f38cdfec9831d2c9c diff --git a/src/RPCError/ChatForbiddenError.php b/src/RPCError/ChatForbiddenError.php index ac61a0a70..9138cbc37 100644 --- a/src/RPCError/ChatForbiddenError.php +++ b/src/RPCError/ChatForbiddenError.php @@ -20,7 +20,7 @@ namespace danog\MadelineProto\RPCError; use danog\MadelineProto\RPCErrorException; /** - * + * This chat is not available to the current user. * * Note: this exception is part of the raw API, and thus is not covered by the backwards-compatibility promise. * @@ -30,6 +30,6 @@ final class ChatForbiddenError extends RPCErrorException { protected function __construct(int $code, string $caller, ?\Exception $previous = null) { - parent::__construct('CHAT_FORBIDDEN', '', $code, $caller, $previous); + parent::__construct('CHAT_FORBIDDEN', 'This chat is not available to the current user.', $code, $caller, $previous); } } diff --git a/src/RPCError/FileTokenInvalidError.php b/src/RPCError/FileTokenInvalidError.php index bce3904f3..53b74c82c 100644 --- a/src/RPCError/FileTokenInvalidError.php +++ b/src/RPCError/FileTokenInvalidError.php @@ -20,7 +20,7 @@ namespace danog\MadelineProto\RPCError; use danog\MadelineProto\RPCErrorException; /** - * The specified file token is invalid. + * The master DC did not accept the `file_token` (e.g., the token has expired). Continue downloading the file from the master DC using upload.getFile. * * Note: this exception is part of the raw API, and thus is not covered by the backwards-compatibility promise. * @@ -30,6 +30,6 @@ final class FileTokenInvalidError extends RPCErrorException { protected function __construct(int $code, string $caller, ?\Exception $previous = null) { - parent::__construct('FILE_TOKEN_INVALID', 'The specified file token is invalid.', $code, $caller, $previous); + parent::__construct('FILE_TOKEN_INVALID', 'The master DC did not accept the `file_token` (e.g., the token has expired). Continue downloading the file from the master DC using upload.getFile.', $code, $caller, $previous); } } diff --git a/src/RPCErrorException.php b/src/RPCErrorException.php index 0a05e4f28..25560a988 100644 --- a/src/RPCErrorException.php +++ b/src/RPCErrorException.php @@ -706,19 +706,14 @@ class RPCErrorException extends \Exception 'WEBPUSH_KEY_INVALID' => new self($rpc, 'The specified web push elliptic curve Diffie-Hellman public key is invalid.', $code, $caller, $previous), 'WEBPUSH_TOKEN_INVALID' => new self($rpc, 'The specified web push token is invalid.', $code, $caller, $previous), 'YOU_BLOCKED_USER' => new \danog\MadelineProto\RPCError\YouBlockedUserError($code, $caller, $previous), - 'BASE_PORT_LOC_INVALID' => new self($rpc, '', $code, $caller, $previous), 'BOT_GAMES_DISABLED' => new self($rpc, '', $code, $caller, $previous), 'BOT_METHOD_INVALID' => new self($rpc, 'The specified method cannot be used by bots.', $code, $caller, $previous), 'BOT_POLLS_DISABLED' => new self($rpc, '', $code, $caller, $previous), - 'CHANNEL_ADD_INVALID' => new self($rpc, '', $code, $caller, $previous), - 'CHANNEL_BANNED' => new self($rpc, '', $code, $caller, $previous), 'CONNECTION_DEVICE_MODEL_EMPTY' => new self($rpc, 'The specified device model is empty.', $code, $caller, $previous), 'CONNECTION_LANG_PACK_INVALID' => new self($rpc, 'The specified language pack is empty.', $code, $caller, $previous), 'CONNECTION_NOT_INITED' => new self($rpc, 'Please initialize the connection using initConnection before making queries.', $code, $caller, $previous), 'CONNECTION_SYSTEM_EMPTY' => new self($rpc, 'The specified system version is empty.', $code, $caller, $previous), 'CONNECTION_SYSTEM_LANG_CODE_EMPTY' => new self($rpc, 'The specified system language code is empty.', $code, $caller, $previous), - 'FIELD_NAME_EMPTY' => new self($rpc, '', $code, $caller, $previous), - 'FIELD_NAME_INVALID' => new self($rpc, '', $code, $caller, $previous), 'GROUP_CALL_INVALID' => new self($rpc, '', $code, $caller, $previous), 'INPUT_CONSTRUCTOR_INVALID' => new self($rpc, 'The specified TL constructor is invalid.', $code, $caller, $previous), 'INPUT_FETCH_ERROR' => new self($rpc, 'An error occurred while parsing the provided TL constructor.', $code, $caller, $previous), @@ -728,12 +723,9 @@ class RPCErrorException extends \Exception 'INPUT_REQUEST_TOO_LONG' => new self($rpc, 'The request payload is too long.', $code, $caller, $previous), 'PEER_FLOOD' => new self($rpc, 'The current account is spamreported, you cannot execute this action, check @spambot for more info.', $code, $caller, $previous), 'PHOTO_THUMB_URL_INVALID' => new self($rpc, '', $code, $caller, $previous), - 'REFLECTOR_NOT_AVAILABLE' => new self($rpc, '', $code, $caller, $previous), - 'SHORTNAME_OCCUPY_FAILED' => new self($rpc, '', $code, $caller, $previous), 'STICKERSET_NOT_MODIFIED' => new self($rpc, '', $code, $caller, $previous), - 'TMP_PASSWORD_INVALID' => new self($rpc, '', $code, $caller, $previous), - 'TYPE_CONSTRUCTOR_INVALID' => new self($rpc, '', $code, $caller, $previous), - 'WEBDOCUMENT_URL_EMPTY' => new self($rpc, '', $code, $caller, $previous), + 'TMP_PASSWORD_INVALID' => new self($rpc, 'The passed tmp_password is invalid.', $code, $caller, $previous), + 'WEBDOCUMENT_URL_EMPTY' => new self($rpc, 'The passed web document URL is empty.', $code, $caller, $previous), 'ANONYMOUS_REACTIONS_DISABLED' => new self($rpc, 'Sorry, anonymous administrators cannot leave reactions or participate in polls.', $code, $caller, $previous), 'BROADCAST_FORBIDDEN' => new self($rpc, 'Channel poll voters and reactions cannot be fetched to prevent deanonymization.', $code, $caller, $previous), 'CHANNEL_PUBLIC_GROUP_NA' => new self($rpc, 'channel/supergroup not available.', $code, $caller, $previous), @@ -778,14 +770,14 @@ class RPCErrorException extends \Exception 'USERPIC_PRIVACY_REQUIRED' => new self($rpc, 'You need to disable privacy settings for your profile picture in order to make your geolocation public.', $code, $caller, $previous), 'AUTH_KEY_DUPLICATED' => new self($rpc, 'Concurrent usage of the current session from multiple connections was detected, the current session was invalidated by the server for security reasons!', $code, $caller, $previous), 'ACTIVE_USER_REQUIRED' => new self($rpc, '', $code, $caller, $previous), - 'AUTH_KEY_INVALID' => new self($rpc, '', $code, $caller, $previous), - 'AUTH_KEY_PERM_EMPTY' => new self($rpc, '', $code, $caller, $previous), - 'AUTH_KEY_UNREGISTERED' => new self($rpc, '', $code, $caller, $previous), - 'SESSION_EXPIRED' => new self($rpc, '', $code, $caller, $previous), + 'AUTH_KEY_INVALID' => new self($rpc, 'The specified auth key is invalid.', $code, $caller, $previous), + 'AUTH_KEY_PERM_EMPTY' => new self($rpc, 'The method is unavailable for temporary authorization keys, not bound to a permanent authorization key.', $code, $caller, $previous), + 'AUTH_KEY_UNREGISTERED' => new self($rpc, 'The specified authorization key is not registered in the system (for example, a PFS temporary key has expired).', $code, $caller, $previous), + 'SESSION_EXPIRED' => new self($rpc, 'The session has expired.', $code, $caller, $previous), 'SESSION_PASSWORD_NEEDED' => new \danog\MadelineProto\RPCError\SessionPasswordNeededError($code, $caller, $previous), - 'SESSION_REVOKED' => new self($rpc, '', $code, $caller, $previous), - 'USER_DEACTIVATED' => new self($rpc, '', $code, $caller, $previous), - 'USER_DEACTIVATED_BAN' => new self($rpc, '', $code, $caller, $previous), + 'SESSION_REVOKED' => new self($rpc, 'The session was revoked by the user.', $code, $caller, $previous), + 'USER_DEACTIVATED' => new self($rpc, 'The current account was deleted by the user.', $code, $caller, $previous), + 'USER_DEACTIVATED_BAN' => new self($rpc, 'The current account was deleted and banned by Telegram\'s antispam system.', $code, $caller, $previous), default => new self($rpc, self::report($rpc, $code, $caller), $code, $caller, $previous) };