accounts: error out when no folder to sync

Such error can be hit when the folderfilter is wrong and excludes all the
folders.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2017-10-02 02:42:33 +02:00
parent 1ce596d713
commit 31eee55672

View File

@ -338,6 +338,7 @@ class SyncableAccount(Account):
quick = False quick = False
try: try:
startedThread = False
remoterepos = self.remoterepos remoterepos = self.remoterepos
localrepos = self.localrepos localrepos = self.localrepos
statusrepos = self.statusrepos statusrepos = self.statusrepos
@ -394,10 +395,15 @@ class SyncableAccount(Account):
folderthreads.append(thread) folderthreads.append(thread)
else: else:
syncfolder(self, remotefolder, quick) syncfolder(self, remotefolder, quick)
startedThread = True
# Wait for all threads to finish. # Wait for all threads to finish.
for thr in folderthreads: for thr in folderthreads:
thr.join() thr.join()
if startedThread is True:
mbnames.writeIntermediateFile(self.name) # Write out mailbox names. mbnames.writeIntermediateFile(self.name) # Write out mailbox names.
else:
msg = "Account {}: no folder to sync (folderfilter issue?)".format(self)
raise OfflineImapError(msg, OfflineImapError.ERROR.REPO)
localrepos.forgetfolders() localrepos.forgetfolders()
remoterepos.forgetfolders() remoterepos.forgetfolders()
except: except: