From 43022a7810507715417040f2e85939bc67b28b89 Mon Sep 17 00:00:00 2001 From: Alex RootJunior Date: Sat, 13 Apr 2019 04:57:24 +0300 Subject: [PATCH] More errors. --- aiogram/utils/exceptions.py | 39 ++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/aiogram/utils/exceptions.py b/aiogram/utils/exceptions.py index b475a6d0..b817e4cc 100644 --- a/aiogram/utils/exceptions.py +++ b/aiogram/utils/exceptions.py @@ -28,7 +28,6 @@ TelegramAPIError ObjectExpectedAsReplyMarkup InlineKeyboardExpected ChatNotFound - ChatIdIsEmpty ChatDescriptionIsNotModified InvalidQueryID InvalidPeerID @@ -43,14 +42,15 @@ TelegramAPIError WebhookRequireHTTPS BadWebhookPort BadWebhookAddrInfo - CantParseUrl + BadWebhookNoAddressAssociatedWithHostname NotFound MethodNotKnown PhotoAsInputFileRequired InvalidStickersSet NoStickerInRequest ChatAdminRequired - NotEnoughRightsToPinMessage + NeedAdministratorRightsInTheChannel + MethodNotAvailableInPrivateChats CantDemoteChatCreator CantRestrictSelf NotEnoughRightsToRestrict @@ -61,7 +61,9 @@ TelegramAPIError PaymentProviderInvalid CurrencyTotalAmountInvalid CantParseUrl + UnsupportedUrlProtocol CantParseEntities + ResultIdDuplicate ConflictError TerminatedByOtherGetUpdates CantGetUpdates @@ -76,6 +78,10 @@ TelegramAPIError MigrateToChat RestartingTelegram + +TODO: aiogram.utils.exceptions.BadRequest: Bad request: can't parse entities: unsupported start tag "function" at byte offset 0 +TODO: aiogram.utils.exceptions.TelegramAPIError: Gateway Timeout + AIOGramWarning TimeoutWarning """ @@ -281,6 +287,11 @@ class ChatIdIsEmpty(BadRequest): match = 'chat_id is empty' +class InvalidUserId(BadRequest): + match = 'user_id_invalid' + text = 'Invalid user id' + + class ChatDescriptionIsNotModified(BadRequest): match = 'chat description is not modified' @@ -347,10 +358,19 @@ class ChatAdminRequired(BadRequest): text = 'Admin permissions is required!' +class NeedAdministratorRightsInTheChannel(BadRequest): + match = 'need administrator rights in the channel chat' + text = 'Admin permissions is required!' + + class NotEnoughRightsToPinMessage(BadRequest): match = 'not enough rights to pin a message' +class MethodNotAvailableInPrivateChats(BadRequest): + match = 'method is available only for supergroups and channel' + + class CantDemoteChatCreator(BadRequest): match = 'can\'t demote chat creator' @@ -410,14 +430,27 @@ class BadWebhookAddrInfo(BadWebhook): text = 'bad webhook: ' + match +class BadWebhookNoAddressAssociatedWithHostname(BadWebhook): + match = 'failed to resolve host: no address associated with hostname' + + class CantParseUrl(BadRequest): match = 'can\'t parse URL' +class UnsupportedUrlProtocol(BadRequest): + match = 'unsupported URL protocol' + + class CantParseEntities(BadRequest): match = 'can\'t parse entities' +class ResultIdDuplicate(BadRequest): + match = 'result_id_duplicate' + text = 'Result ID duplicate' + + class NotFound(TelegramAPIError, _MatchErrorMixin): __group = True