Oops. Fix error message cleaner. (In past it can strip first symbol in message)

This commit is contained in:
Alex Root Junior 2017-08-15 05:48:56 +03:00
parent b65f181402
commit 6b26687fe0

View file

@ -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):