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