diff --git a/telethon/errors/__init__.py b/telethon/errors/__init__.py index 08ccee20..cf1093ea 100644 --- a/telethon/errors/__init__.py +++ b/telethon/errors/__init__.py @@ -18,10 +18,10 @@ from .rpc_errors_420 import * def rpc_message_to_error(code, message): errors = { - 303: rpc_303_errors, - 400: rpc_400_errors, - 401: rpc_401_errors, - 420: rpc_420_errors + 303: rpc_errors_303_all, + 400: rpc_errors_400_all, + 401: rpc_errors_401_all, + 420: rpc_errors_420_all }.get(code, None) if errors is not None: diff --git a/telethon/errors/rpc_errors_303.py b/telethon/errors/rpc_errors_303.py index fcef7825..21963154 100644 --- a/telethon/errors/rpc_errors_303.py +++ b/telethon/errors/rpc_errors_303.py @@ -43,7 +43,7 @@ class UserMigrateError(InvalidDCError): ) -rpc_303_errors = { +rpc_errors_303_all = { 'FILE_MIGRATE_(\d+)': FileMigrateError, 'PHONE_MIGRATE_(\d+)': PhoneMigrateError, 'NETWORK_MIGRATE_(\d+)': NetworkMigrateError, diff --git a/telethon/errors/rpc_errors_400.py b/telethon/errors/rpc_errors_400.py index 57966fd6..66e9bfe7 100644 --- a/telethon/errors/rpc_errors_400.py +++ b/telethon/errors/rpc_errors_400.py @@ -321,7 +321,7 @@ class UserIdInvalidError(BadRequestError): ) -rpc_400_errors = { +rpc_errors_400_all = { 'API_ID_INVALID': ApiIdInvalidError, 'BOT_METHOD_INVALID': BotMethodInvalidError, 'CHANNEL_INVALID': ChannelInvalidError, diff --git a/telethon/errors/rpc_errors_401.py b/telethon/errors/rpc_errors_401.py index 03ebb3fb..5b22cb73 100644 --- a/telethon/errors/rpc_errors_401.py +++ b/telethon/errors/rpc_errors_401.py @@ -84,7 +84,7 @@ class UserDeactivatedError(UnauthorizedError): ) -rpc_401_errors = { +rpc_errors_401_all = { 'ACTIVE_USER_REQUIRED': ActiveUserRequiredError, 'AUTH_KEY_INVALID': AuthKeyInvalidError, 'AUTH_KEY_PERM_EMPTY': AuthKeyPermEmptyError, diff --git a/telethon/errors/rpc_errors_420.py b/telethon/errors/rpc_errors_420.py index 3c760bc8..8106cc5c 100644 --- a/telethon/errors/rpc_errors_420.py +++ b/telethon/errors/rpc_errors_420.py @@ -11,6 +11,6 @@ class FloodWaitError(FloodError): ) -rpc_420_errors = { +rpc_errors_420_all = { 'FLOOD_WAIT_(\d+)': FloodWaitError }