From 9811a6c6b723cf278d9ba141302033801f93d713 Mon Sep 17 00:00:00 2001 From: drebs Date: Mon, 3 Oct 2016 12:00:06 -0300 Subject: [feature] stop fetching mail on inavalid token error --- src/leap/bitmask/mail/incoming/service.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/leap/bitmask/mail/incoming/service.py b/src/leap/bitmask/mail/incoming/service.py index b18ed74..1ab6df9 100644 --- a/src/leap/bitmask/mail/incoming/service.py +++ b/src/leap/bitmask/mail/incoming/service.py @@ -224,16 +224,15 @@ class IncomingMail(Service): logger.info('sync finished') return result - def _signal_invalid_auth(failure): + def _handle_invalid_auth_token_error(failure): failure.trap(InvalidAuthTokenError) - logger.warn('sync failed because token has expired: %r' % failure) - # if the token is invalid, send an event so the GUI can - # disable mail and show an error message. + logger.warn('sync failed because token is invalid: %r' % failure) + self.stopService() emit_async(catalog.SOLEDAD_INVALID_AUTH_TOKEN, self._userid) logger.info('starting sync...') d = self._soledad.sync() - d.addCallbacks(_log_synced, _signal_invalid_auth) + d.addCallbacks(_log_synced, _handle_invalid_auth_token_error) return d def _signal_fetch_to_ui(self, doclist): -- cgit v1.2.3