diff --git a/aiogram/bot/api.py b/aiogram/bot/api.py index bb92f8b2..123c5359 100644 --- a/aiogram/bot/api.py +++ b/aiogram/bot/api.py @@ -91,6 +91,8 @@ async def _check_result(method_name, response): exceptions.BadWebhookPort.throw() elif exceptions.CantParseUrl.check(description): exceptions.CantParseUrl.throw() + elif exceptions.PhotoAsInputFileRequired.check(description): + exceptions.PhotoAsInputFileRequired.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 f7296eae..16fef497 100644 --- a/aiogram/utils/exceptions.py +++ b/aiogram/utils/exceptions.py @@ -130,6 +130,10 @@ class GroupDeactivated(BadRequest, _MatchErrorMixin): match = 'group is deactivated' +class PhotoAsInputFileRequired(BadRequest, _MatchErrorMixin): + match = 'Photo should be uploaded as an InputFile' + + class BadWebhook(BadRequest): pass