Add InvalidStickersSet exception

This commit is contained in:
Alex Root Junior 2018-04-22 22:02:58 +03:00
parent a941a00abc
commit e3e1ed9ed7
2 changed files with 10 additions and 2 deletions

View file

@ -98,6 +98,8 @@ async def _check_result(method_name, response):
exceptions.ToMuchMessages.throw() exceptions.ToMuchMessages.throw()
elif exceptions.InvalidStickersSet.check(description): elif exceptions.InvalidStickersSet.check(description):
exceptions.InvalidStickersSet.throw() exceptions.InvalidStickersSet.throw()
elif exceptions.ChatAdminRequired.check(description):
exceptions.ChatAdminRequired.throw()
raise exceptions.BadRequest(description) raise exceptions.BadRequest(description)
elif response.status == HTTPStatus.NOT_FOUND: elif response.status == HTTPStatus.NOT_FOUND:
if exceptions.MethodNotKnown.check(description): if exceptions.MethodNotKnown.check(description):

View file

@ -23,6 +23,7 @@ TelegramAPIError
PhotoAsInputFileRequired PhotoAsInputFileRequired
ToMuchMessages ToMuchMessages
InvalidStickersSet InvalidStickersSet
ChatAdminRequired
ConflictError ConflictError
TerminatedByOtherGetUpdates TerminatedByOtherGetUpdates
CantGetUpdates CantGetUpdates
@ -162,16 +163,21 @@ class InvalidStickersSet(BadRequest, _MatchErrorMixin):
text = 'Stickers set is invalid' text = 'Stickers set is invalid'
class ChatAdminRequired(BadRequest, _MatchErrorMixin):
match = 'CHAT_ADMIN_REQUIRED'
text = 'Admin permissions is required!'
class BadWebhook(BadRequest): class BadWebhook(BadRequest):
pass pass
class WebhookRequireHTTPS(BadRequest, _MatchErrorMixin): class WebhookRequireHTTPS(BadWebhook, _MatchErrorMixin):
match = 'HTTPS url must be provided for webhook' match = 'HTTPS url must be provided for webhook'
text = 'bad webhook: ' + match text = 'bad webhook: ' + match
class BadWebhookPort(BadRequest, _MatchErrorMixin): class BadWebhookPort(BadWebhook, _MatchErrorMixin):
match = 'Webhook can be set up only on ports 80, 88, 443 or 8443' match = 'Webhook can be set up only on ports 80, 88, 443 or 8443'
text = 'bad webhook: ' + match text = 'bad webhook: ' + match