mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 18:19:34 +00:00
Add new error types: ButtonURLInvalid, URLHostIsEmpty, StartParamInvalid, ButtonDataInvalid.
This commit is contained in:
parent
dc3f1b1c82
commit
c167c559d8
1 changed files with 27 additions and 2 deletions
|
|
@ -14,6 +14,10 @@ TelegramAPIError
|
||||||
InvalidQueryID
|
InvalidQueryID
|
||||||
InvalidPeerID
|
InvalidPeerID
|
||||||
InvalidHTTPUrlContent
|
InvalidHTTPUrlContent
|
||||||
|
ButtonURLInvalid
|
||||||
|
URLHostIsEmpty
|
||||||
|
StartParamInvalid
|
||||||
|
ButtonDataInvalid
|
||||||
WrongFileIdentifier
|
WrongFileIdentifier
|
||||||
GroupDeactivated
|
GroupDeactivated
|
||||||
BadWebhook
|
BadWebhook
|
||||||
|
|
@ -48,6 +52,8 @@ AIOGramWarning
|
||||||
"""
|
"""
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
# TODO: Use exceptions detector from `aiograph`.
|
||||||
|
|
||||||
_PREFIXES = ['Error: ', '[Error]: ', 'Bad Request: ', 'Conflict: ', 'Not Found: ']
|
_PREFIXES = ['Error: ', '[Error]: ', 'Bad Request: ', 'Conflict: ', 'Not Found: ']
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -183,6 +189,25 @@ class InvalidHTTPUrlContent(BadRequest):
|
||||||
match = 'Failed to get HTTP URL content'
|
match = 'Failed to get HTTP URL content'
|
||||||
|
|
||||||
|
|
||||||
|
class ButtonURLInvalid(BadRequest):
|
||||||
|
match = 'BUTTON_URL_INVALID'
|
||||||
|
text = 'Button URL invalid'
|
||||||
|
|
||||||
|
|
||||||
|
class URLHostIsEmpty(BadRequest):
|
||||||
|
match = 'URL host is empty'
|
||||||
|
|
||||||
|
|
||||||
|
class StartParamInvalid(BadRequest):
|
||||||
|
match = 'START_PARAM_INVALID'
|
||||||
|
text = 'Start param invalid'
|
||||||
|
|
||||||
|
|
||||||
|
class ButtonDataInvalid(BadRequest):
|
||||||
|
match = 'BUTTON_DATA_INVALID'
|
||||||
|
text = 'Button data invalid'
|
||||||
|
|
||||||
|
|
||||||
class WrongFileIdentifier(BadRequest):
|
class WrongFileIdentifier(BadRequest):
|
||||||
match = 'wrong file identifier/HTTP URL specified'
|
match = 'wrong file identifier/HTTP URL specified'
|
||||||
|
|
||||||
|
|
@ -207,12 +232,12 @@ class ChatAdminRequired(BadRequest):
|
||||||
match = 'CHAT_ADMIN_REQUIRED'
|
match = 'CHAT_ADMIN_REQUIRED'
|
||||||
text = 'Admin permissions is required!'
|
text = 'Admin permissions is required!'
|
||||||
|
|
||||||
|
|
||||||
class CantRestrictSelf(BadRequest):
|
class CantRestrictSelf(BadRequest):
|
||||||
match = "can't restrict self"
|
match = "can't restrict self"
|
||||||
text = "Admin can't restrict self."
|
text = "Admin can't restrict self."
|
||||||
|
|
||||||
|
|
||||||
class PhotoDimensions(BadRequest):
|
class PhotoDimensions(BadRequest):
|
||||||
match = 'PHOTO_INVALID_DIMENSIONS'
|
match = 'PHOTO_INVALID_DIMENSIONS'
|
||||||
text = 'Invalid photo dimensions'
|
text = 'Invalid photo dimensions'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue