mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 01:54:53 +00:00
Oops. Fix error message cleaner. (In past it can strip first symbol in message)
This commit is contained in:
parent
b65f181402
commit
6b26687fe0
1 changed files with 7 additions and 5 deletions
|
|
@ -1,9 +1,11 @@
|
|||
_PREFIXES = ['Error: ', '[Error]: ', 'Bad Request: ']
|
||||
|
||||
|
||||
def _clean_message(text):
|
||||
return text. \
|
||||
lstrip('Error: '). \
|
||||
lstrip('[Error]: '). \
|
||||
lstrip('Bad Request: '). \
|
||||
capitalize()
|
||||
for prefix in _PREFIXES:
|
||||
if text.startswith(prefix):
|
||||
text = text[len(prefix):]
|
||||
return text
|
||||
|
||||
|
||||
class TelegramAPIError(Exception):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue