Add new known errors to the error list

This commit is contained in:
Lonami Exo 2020-12-04 20:42:44 +01:00
parent 12380207ba
commit 0b0a1dc6a1
3 changed files with 13 additions and 1 deletions

View File

@ -1,4 +1,5 @@
name,codes,description
2FA_CONFIRM_WAIT_X,420,The account is 2FA protected so it will be deleted in a week. Otherwise it can be reset in {seconds}
ABOUT_TOO_LONG,400,The provided bio is too long
ACCESS_TOKEN_EXPIRED,400,Bot token expired
ACCESS_TOKEN_INVALID,400,The provided token is not valid
@ -22,6 +23,7 @@ AUTH_TOKEN_EXPIRED,400,The provided authorization token has expired and the upda
AUTH_TOKEN_INVALID,400,An invalid authorization token was provided
AUTOARCHIVE_NOT_AVAILABLE,400,You cannot use this feature yet
BANK_CARD_NUMBER_INVALID,400,Incorrect credit card number
BASE_PORT_LOC_INVALID,400,Base port location invalid
BANNED_RIGHTS_INVALID,400,"You cannot use that set of permissions in this request, i.e. restricting view_messages as a default"
BOTS_TOO_MUCH,400,There are too many bots in this chat/channel
BOT_CHANNELS_NA,400,Bots can't edit admin privileges
@ -134,6 +136,7 @@ FRESH_RESET_AUTHORISATION_FORBIDDEN,406,The current session is too new and canno
GAME_BOT_INVALID,400,You cannot send that game with the current bot
GIF_ID_INVALID,400,The provided GIF ID is invalid
GRAPH_OUTDATED_RELOAD,400,"Data can't be used for the channel statistics, graphs outdated"
GROUP_CALL_INVALID,400,Group call invalid
GROUPED_MEDIA_INVALID,400,Invalid grouped media
HASH_INVALID,400,The provided hash is invalid
HISTORY_GET_FAILED,500,Fetching of history failed
@ -256,6 +259,7 @@ RANDOM_LENGTH_INVALID,400,Random length invalid
RANGES_INVALID,400,Invalid range provided
REACTION_EMPTY,400,No reaction provided
REACTION_INVALID,400,Invalid reaction provided (only emoji are allowed)
REFLECTOR_NOT_AVAILABLE,400,Invalid call reflector server
REG_ID_GENERATE_FAILED,500,Failure while generating registration ID
REPLY_MARKUP_GAME_EMPTY,400,The provided reply markup for the game is empty
REPLY_MARKUP_INVALID,400,The provided reply markup is invalid
@ -304,6 +308,7 @@ TAKEOUT_INVALID,400,The takeout session has been invalidated by another data exp
TAKEOUT_REQUIRED,400,You must initialize a takeout request first
TEMP_AUTH_KEY_EMPTY,400,No temporary auth key provided
Timeout,-503,A timeout occurred while fetching data from the worker
THEME_INVALID,400,Theme invalid
THEME_MIME_INVALID,400,"You cannot create this theme, the mime-type is invalid"
TMP_PASSWORD_DISABLED,400,The temporary password is disabled
TOKEN_INVALID,400,The provided token is invalid

1 name codes description
2 2FA_CONFIRM_WAIT_X 420 The account is 2FA protected so it will be deleted in a week. Otherwise it can be reset in {seconds}
3 ABOUT_TOO_LONG 400 The provided bio is too long
4 ACCESS_TOKEN_EXPIRED 400 Bot token expired
5 ACCESS_TOKEN_INVALID 400 The provided token is not valid
23 AUTH_TOKEN_INVALID 400 An invalid authorization token was provided
24 AUTOARCHIVE_NOT_AVAILABLE 400 You cannot use this feature yet
25 BANK_CARD_NUMBER_INVALID 400 Incorrect credit card number
26 BASE_PORT_LOC_INVALID 400 Base port location invalid
27 BANNED_RIGHTS_INVALID 400 You cannot use that set of permissions in this request, i.e. restricting view_messages as a default
28 BOTS_TOO_MUCH 400 There are too many bots in this chat/channel
29 BOT_CHANNELS_NA 400 Bots can't edit admin privileges
136 GAME_BOT_INVALID 400 You cannot send that game with the current bot
137 GIF_ID_INVALID 400 The provided GIF ID is invalid
138 GRAPH_OUTDATED_RELOAD 400 Data can't be used for the channel statistics, graphs outdated
139 GROUP_CALL_INVALID 400 Group call invalid
140 GROUPED_MEDIA_INVALID 400 Invalid grouped media
141 HASH_INVALID 400 The provided hash is invalid
142 HISTORY_GET_FAILED 500 Fetching of history failed
259 RANGES_INVALID 400 Invalid range provided
260 REACTION_EMPTY 400 No reaction provided
261 REACTION_INVALID 400 Invalid reaction provided (only emoji are allowed)
262 REFLECTOR_NOT_AVAILABLE 400 Invalid call reflector server
263 REG_ID_GENERATE_FAILED 500 Failure while generating registration ID
264 REPLY_MARKUP_GAME_EMPTY 400 The provided reply markup for the game is empty
265 REPLY_MARKUP_INVALID 400 The provided reply markup is invalid
308 TAKEOUT_REQUIRED 400 You must initialize a takeout request first
309 TEMP_AUTH_KEY_EMPTY 400 No temporary auth key provided
310 Timeout -503 A timeout occurred while fetching data from the worker
311 THEME_INVALID 400 Theme invalid
312 THEME_MIME_INVALID 400 You cannot create this theme, the mime-type is invalid
313 TMP_PASSWORD_DISABLED 400 The temporary password is disabled
314 TOKEN_INVALID 400 The provided token is invalid

View File

@ -6,6 +6,7 @@ account.checkUsername,user,USERNAME_INVALID
account.confirmPasswordEmail,user,
account.confirmPhone,user,CODE_HASH_INVALID PHONE_CODE_EMPTY
account.createTheme,user,THEME_MIME_INVALID
account.deleteAccount,user,2FA_CONFIRM_WAIT_X
account.deleteSecureValue,user,
account.finishTakeoutSession,user,
account.getAccountTTL,user,
@ -58,7 +59,7 @@ account.updateNotifySettings,user,PEER_ID_INVALID
account.updatePasswordSettings,user,EMAIL_UNCONFIRMED_X NEW_SALT_INVALID NEW_SETTINGS_INVALID PASSWORD_HASH_INVALID
account.updateProfile,user,ABOUT_TOO_LONG FIRSTNAME_INVALID
account.updateStatus,user,SESSION_PASSWORD_NEEDED
account.updateTheme,user,
account.updateTheme,user,THEME_INVALID
account.updateUsername,user,USERNAME_INVALID USERNAME_NOT_MODIFIED USERNAME_OCCUPIED
account.uploadTheme,user,
account.uploadWallPaper,user,WALLPAPER_FILE_INVALID

1 method usability errors
6 account.confirmPasswordEmail user
7 account.confirmPhone user CODE_HASH_INVALID PHONE_CODE_EMPTY
8 account.createTheme user THEME_MIME_INVALID
9 account.deleteAccount user 2FA_CONFIRM_WAIT_X
10 account.deleteSecureValue user
11 account.finishTakeoutSession user
12 account.getAccountTTL user
59 account.updatePasswordSettings user EMAIL_UNCONFIRMED_X NEW_SALT_INVALID NEW_SETTINGS_INVALID PASSWORD_HASH_INVALID
60 account.updateProfile user ABOUT_TOO_LONG FIRSTNAME_INVALID
61 account.updateStatus user SESSION_PASSWORD_NEEDED
62 account.updateTheme user THEME_INVALID
63 account.updateUsername user USERNAME_INVALID USERNAME_NOT_MODIFIED USERNAME_OCCUPIED
64 account.uploadTheme user
65 account.uploadWallPaper user WALLPAPER_FILE_INVALID

View File

@ -27,6 +27,12 @@ def _get_class_name(error_code):
abs(error_code), 'RPCError' + str(error_code).replace('-', 'Neg')
)
if error_code.startswith('2'):
error_code = re.sub(r'2', 'TWO_', error_code, count=1)
if re.match(r'\d+', error_code):
raise RuntimeError('error code starting with a digit cannot have valid Python name: {}'.format(error_code))
return snake_to_camel_case(
error_code.replace('FIRSTNAME', 'FIRST_NAME')\
.replace('SLOWMODE', 'SLOW_MODE').lower(), suffix='Error')