Fixing error handling for the inbox command

This commit is contained in:
Michael Lazar
2018-01-21 19:38:35 -05:00
parent fe25e13dcd
commit 47e5414be0
5 changed files with 903 additions and 3 deletions

View File

@@ -290,9 +290,13 @@ class Page(object):
Checks the inbox for unread messages and displays a notification.
"""
inbox = len(list(self.reddit.get_unread(limit=1)))
message = 'New Messages' if inbox > 0 else 'No New Messages'
self.term.show_notification(message)
with self.term.loader('Loading'):
messages = self.reddit.get_unread(limit=1)
inbox = len(list(messages))
if self.term.loader.exception is None:
message = 'New Messages' if inbox > 0 else 'No New Messages'
self.term.show_notification(message)
@PageController.register(Command('COPY_PERMALINK'))
def copy_permalink(self):