mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 10:11:52 +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):
|
def _clean_message(text):
|
||||||
return text. \
|
for prefix in _PREFIXES:
|
||||||
lstrip('Error: '). \
|
if text.startswith(prefix):
|
||||||
lstrip('[Error]: '). \
|
text = text[len(prefix):]
|
||||||
lstrip('Bad Request: '). \
|
return text
|
||||||
capitalize()
|
|
||||||
|
|
||||||
|
|
||||||
class TelegramAPIError(Exception):
|
class TelegramAPIError(Exception):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue