mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-29 12:53:44 +03:00
Better error diagnostics and fix parsing errors.csv
This commit is contained in:
parent
d1fee27814
commit
86a8928278
|
@ -13,7 +13,7 @@ AUTH_KEY_INVALID,401,The key is invalid
|
||||||
AUTH_KEY_PERM_EMPTY,401,"The method is unavailable for temporary authorization key, not bound to permanent"
|
AUTH_KEY_PERM_EMPTY,401,"The method is unavailable for temporary authorization key, not bound to permanent"
|
||||||
AUTH_KEY_UNREGISTERED,401,The key is not registered in the system
|
AUTH_KEY_UNREGISTERED,401,The key is not registered in the system
|
||||||
AUTH_RESTART,500,Restart the authorization process
|
AUTH_RESTART,500,Restart the authorization process
|
||||||
BANNED_RIGHTS_INVALID,400,You cannot use that set of permissions in this request, i.e. restricting view_messages as a default
|
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
|
BOTS_TOO_MUCH,400,There are too many bots in this chat/channel
|
||||||
BOT_CHANNELS_NA,400,Bots can't edit admin privileges
|
BOT_CHANNELS_NA,400,Bots can't edit admin privileges
|
||||||
BOT_GROUPS_BLOCKED,400,This bot can't be added to groups
|
BOT_GROUPS_BLOCKED,400,This bot can't be added to groups
|
||||||
|
|
Can't render this file because it has a wrong number of fields in line 16.
|
|
@ -60,7 +60,13 @@ def parse_errors(csv_file):
|
||||||
with csv_file.open(newline='') as f:
|
with csv_file.open(newline='') as f:
|
||||||
f = csv.reader(f)
|
f = csv.reader(f)
|
||||||
next(f, None) # header
|
next(f, None) # header
|
||||||
for line, (name, codes, description) in enumerate(f, start=2):
|
for line, tup in enumerate(f, start=2):
|
||||||
|
try:
|
||||||
|
name, codes, description = tup
|
||||||
|
except ValueError:
|
||||||
|
raise ValueError('Columns count mismatch, unquoted comma in '
|
||||||
|
'desc? (line {})'.format(line)) from None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
codes = [int(x) for x in codes.split()] or [400]
|
codes = [int(x) for x in codes.split()] or [400]
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user