Handle new Tweepy exceptions properly. #403

This commit is contained in:
2021-10-07 09:20:06 -05:00
parent d8fca3b31a
commit 286e030f40
10 changed files with 50 additions and 46 deletions

View File

@@ -50,8 +50,8 @@ class listsController(object):
self.session.db["lists"].append(new_list)
self.dialog.lista.insert_item(False, *compose.compose_list(new_list))
except TweepyException as e:
output.speak("error %s: %s" % (e.api_code, e.reason))
log.exception("error %s: %s" % (e.api_code, e.reason))
output.speak("error %s" % (str(e)))
log.exception("error %s" % (str(e)))
dialog.destroy()
def edit_list(self, *args, **kwargs):
@@ -71,7 +71,8 @@ class listsController(object):
self.session.get_lists()
self.dialog.populate_list(self.get_all_lists(), True)
except TweepyException as e:
output.speak("error %s: %s" % (e.api_code, e.reason))
output.speak("error %s" % (str(e)))
log.exception("error %s" % (str(e)))
dialog.destroy()
def remove_list(self, *args, **kwargs):
@@ -83,7 +84,8 @@ class listsController(object):
self.session.db["lists"].pop(self.dialog.get_item())
self.dialog.lista.remove_item(self.dialog.get_item())
except TweepyException as e:
output.speak("error %s: %s" % (e.api_code, e.reason))
output.speak("error %s" % (str(e)))
log.exception("error %s" % (str(e)))
def open_list_as_buffer(self, *args, **kwargs):
if self.dialog.lista.get_count() == 0: return
@@ -98,7 +100,8 @@ class listsController(object):
item = utils.find_item(list.id, self.session.db["lists"])
self.session.db["lists"].append(list)
except TweepyException as e:
output.speak("error %s: %s" % (e.api_code, e.reason))
output.speak("error %s" % (str(e)))
log.exception("error %s" % (str(e)))
def unsubscribe(self, *args, **kwargs):
if self.dialog.lista.get_count() == 0: return
@@ -107,4 +110,5 @@ class listsController(object):
list = self.session.twitter.unsubscribe_list(list_id=list_id)
self.session.db["lists"].remove(list)
except TweepyException as e:
output.speak("error %s: %s" % (e.api_code, e.reason))
output.speak("error %s" % (str(e)))
log.exception("error %s" % (str(e)))