From e2ce3d095549e4fd06c104a305a3b698d0c45187 Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Thu, 24 Sep 2015 11:48:04 +0200 Subject: [bug] signal expired auth token to the GUI In case of InvalidAuthTokeError from soledad sync we need signal the GUI, so it will request her to log in again. - Resolves: #7430 --- src/leap/mail/incoming/service.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/leap/mail') diff --git a/src/leap/mail/incoming/service.py b/src/leap/mail/incoming/service.py index d554c51..d8b91ba 100644 --- a/src/leap/mail/incoming/service.py +++ b/src/leap/mail/incoming/service.py @@ -228,18 +228,18 @@ class IncomingMail(Service): def _log_synced(result): log.msg('FETCH soledad SYNCED.') return result - try: - log.msg('FETCH: syncing soledad...') - d = self._soledad.sync() - d.addCallback(_log_synced) - return d - # TODO is this still raised? or should we do failure.trap - # instead? - except InvalidAuthTokenError: + + def _signal_invalid_auth(failure): + failure.trap(InvalidAuthTokenError) # if the token is invalid, send an event so the GUI can # disable mail and show an error message. emit_async(catalog.SOLEDAD_INVALID_AUTH_TOKEN) + log.msg('FETCH: syncing soledad...') + d = self._soledad.sync() + d.addCallbacks(_log_synced, _signal_invalid_auth) + return d + def _signal_fetch_to_ui(self, doclist): """ Send leap events to ui. -- cgit v1.2.3