diff --git a/aiogram/bot/api.py b/aiogram/bot/api.py index 8d2589e3..d80cd235 100644 --- a/aiogram/bot/api.py +++ b/aiogram/bot/api.py @@ -100,6 +100,12 @@ async def _check_result(method_name, response): exceptions.InvalidStickersSet.throw() elif exceptions.ChatAdminRequired.check(description): exceptions.ChatAdminRequired.throw() + elif exceptions.PhotoDimensions.check(description): + exceptions.PhotoDimensions.throw() + elif exceptions.UnavailableMembers.check(description): + exceptions.UnavailableMembers.throw() + elif exceptions.TypeOfFileMismatch.check(description): + exceptions.TypeOfFileMismatch.throw() raise exceptions.BadRequest(description) elif response.status == HTTPStatus.NOT_FOUND: if exceptions.MethodNotKnown.check(description): diff --git a/aiogram/utils/exceptions.py b/aiogram/utils/exceptions.py index c0910e48..fa846ca3 100644 --- a/aiogram/utils/exceptions.py +++ b/aiogram/utils/exceptions.py @@ -24,6 +24,9 @@ TelegramAPIError ToMuchMessages InvalidStickersSet ChatAdminRequired + PhotoDimensions + UnavailableMembers + TypeOfFileMismatch ConflictError TerminatedByOtherGetUpdates CantGetUpdates @@ -168,6 +171,19 @@ class ChatAdminRequired(BadRequest, _MatchErrorMixin): text = 'Admin permissions is required!' +class PhotoDimensions(BadRequest, _MatchErrorMixin): + match = 'PHOTO_INVALID_DIMENSIONS' + text = 'Invalid photo dimensions' + + +class UnavailableMembers(BadRequest, _MatchErrorMixin): + match = 'supergroup members are unavailable' + + +class TypeOfFileMismatch(BadRequest, _MatchErrorMixin): + match = 'type of file mismatch' + + class BadWebhook(BadRequest): pass