API errors should be spoken from Twython. Fixes #310

This commit is contained in:
Manuel Cortez 2019-10-03 09:26:54 -05:00
parent 80212fc61f
commit d97733fb1a

View File

@ -208,13 +208,13 @@ class Session(base.baseSession):
val = getattr(self.twitter, call_name)(*args, **kwargs) val = getattr(self.twitter, call_name)(*args, **kwargs)
finished = True finished = True
except TwythonError as e: except TwythonError as e:
output.speak(e.message) output.speak(e.msg)
val = None val = None
if e.error_code != 403 and e.error_code != 404: if e.error_code != 403 and e.error_code != 404:
tries = tries+1 tries = tries+1
time.sleep(5) time.sleep(5)
elif report_failure and hasattr(e, 'message'): elif report_failure and hasattr(e, 'message'):
output.speak(_("%s failed. Reason: %s") % (action, e.message)) output.speak(_("%s failed. Reason: %s") % (action, e.msg))
finished = True finished = True
# except: # except:
# tries = tries + 1 # tries = tries + 1