diff --git a/src/js/app-controller.js b/src/js/app-controller.js index c4940b0..98caa47 100644 --- a/src/js/app-controller.js +++ b/src/js/app-controller.js @@ -123,7 +123,19 @@ define(function(require) { console.log('IMAP error.', err); console.log('IMAP reconnecting...'); // re-init client modules on error - self.onConnect(callback); + self.onConnect(function(err) { + if (!self._initialized) { + callback(err); + return; + } + + if (err) { + console.error('IMAP reconnect failed!', err); + return; + } + + console.log('IMAP reconnect attempt complete.'); + }); }; // connect to clients diff --git a/src/js/controller/navigation.js b/src/js/controller/navigation.js index f0ae27b..1b33ddf 100644 --- a/src/js/controller/navigation.js +++ b/src/js/controller/navigation.js @@ -19,6 +19,9 @@ define(function(require) { // attach global error handler errorUtil.attachHandler($scope); + // app controller is initialized + appController._initialized = true; + emailDao = appController._emailDao; outboxBo = appController._outboxBo;