Exit with nice error message failing to get repositories
If we throw an OfflineImapError in case of the Repository() initialization, we display the nice error message and exit rather than bomb out with a traceback. Misconfiguring a repository name in the configuration file is now nicely pointed out to the user. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
parent
103524c979
commit
04ffae2f00
@ -217,13 +217,19 @@ class SyncableAccount(Account):
|
|||||||
|
|
||||||
def syncrunner(self):
|
def syncrunner(self):
|
||||||
self.ui.registerthread(self)
|
self.ui.registerthread(self)
|
||||||
accountmetadata = self.getaccountmeta()
|
try:
|
||||||
if not os.path.exists(accountmetadata):
|
accountmetadata = self.getaccountmeta()
|
||||||
os.mkdir(accountmetadata, 0o700)
|
if not os.path.exists(accountmetadata):
|
||||||
|
os.mkdir(accountmetadata, 0o700)
|
||||||
|
|
||||||
self.remoterepos = Repository(self, 'remote')
|
self.remoterepos = Repository(self, 'remote')
|
||||||
self.localrepos = Repository(self, 'local')
|
self.localrepos = Repository(self, 'local')
|
||||||
self.statusrepos = Repository(self, 'status')
|
self.statusrepos = Repository(self, 'status')
|
||||||
|
except OfflineImapError as e:
|
||||||
|
self.ui.error(e, exc_info()[2])
|
||||||
|
if e.severity >= OfflineImapError.ERROR.CRITICAL:
|
||||||
|
raise
|
||||||
|
return
|
||||||
|
|
||||||
# Loop account sync if needed (bail out after 3 failures)
|
# Loop account sync if needed (bail out after 3 failures)
|
||||||
looping = 3
|
looping = 3
|
||||||
|
Loading…
Reference in New Issue
Block a user