From e07115a09fde68351a47648af99709e341120396 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Mon, 16 Apr 2018 00:36:14 +0300 Subject: [PATCH] Add InvalidStickersSet exception --- aiogram/bot/api.py | 2 ++ aiogram/utils/exceptions.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/aiogram/bot/api.py b/aiogram/bot/api.py index 7c4b35b7..443b5a2e 100644 --- a/aiogram/bot/api.py +++ b/aiogram/bot/api.py @@ -96,6 +96,8 @@ async def _check_result(method_name, response): exceptions.PhotoAsInputFileRequired.throw() elif exceptions.ToMuchMessages.check(description): exceptions.ToMuchMessages.throw() + elif exceptions.InvalidStickersSet.check(description): + exceptions.InvalidStickersSet.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 7b52091e..f9676f1b 100644 --- a/aiogram/utils/exceptions.py +++ b/aiogram/utils/exceptions.py @@ -22,6 +22,7 @@ TelegramAPIError MethodNotKnown PhotoAsInputFileRequired ToMuchMessages + InvalidStickersSet ConflictError TerminatedByOtherGetUpdates CantGetUpdates @@ -156,6 +157,11 @@ class ToMuchMessages(BadRequest, _MatchErrorMixin): match = 'Too much messages to send as an album' +class InvalidStickersSet(BadRequest, _MatchErrorMixin): + match = 'STICKERSET_INVALID' + text = 'Stickers set is invalid' + + class BadWebhook(BadRequest): pass