From 6b64f874628284c0fa6aea56bb8ee45264d31309 Mon Sep 17 00:00:00 2001 From: Nicolas Sebrecht Date: Mon, 2 Oct 2017 21:21:48 +0200 Subject: [PATCH] provide non-zero exit code & display configuration mismatch error at the end of the run This behaviour is what users would expected most. The error message is about utf8foldernames and decodefoldernames. Signed-off-by: Nicolas Sebrecht --- offlineimap/accounts.py | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/offlineimap/accounts.py b/offlineimap/accounts.py index 71b5135..6c63621 100644 --- a/offlineimap/accounts.py +++ b/offlineimap/accounts.py @@ -274,21 +274,6 @@ class SyncableAccount(Account): raise return - if self.utf_8_support and self.remoterepos.getdecodefoldernames(): - e = OfflineImapError("Configuration mismatch in account " + - "'%s'. "% self.getname() + - "\nAccount setting 'utf8foldernames' and repository " + - "setting 'decodefoldernames'\nmay not be used at the " + - "same time. This account has not been synchronized.\n" + - "Please check the configuration and documentation.", - OfflineImapError.ERROR.REPO) - self.ui.error(e, exc_info()[2], - msg="Configuration mismatch in account " + - "'%s'. "% self.getname()) - # Abort *this* account without doing any changes. - # Other accounts are not affected. - return - # Loop account sync if needed (bail out after 3 failures). looping = 3 while looping: @@ -341,6 +326,15 @@ class SyncableAccount(Account): hook = self.getconf('presynchook', '') self.callhook(hook) + if self.utf_8_support and self.remoterepos.getdecodefoldernames(): + raise OfflineImapError("Configuration mismatch in account " + + "'%s'. "% self.getname() + + "\nAccount setting 'utf8foldernames' and repository " + + "setting 'decodefoldernames'\nmay not be used at the " + + "same time. This account has not been synchronized.\n" + + "Please check the configuration and documentation.", + OfflineImapError.ERROR.REPO) + quickconfig = self.getconfint('quick', 0) if quickconfig < 0: quick = True