]> code.delx.au - offlineimap/blobdiff - offlineimap/init.py
Instead of blowing up when the account name is missing, display a useful error messag...
[offlineimap] / offlineimap / init.py
index 45a57737bc39a30bdb47391a83efe34c6fd61087..07809885c56a40e162d38ce7062fa946281b6e65 100644 (file)
@@ -113,6 +113,14 @@ def startup(versionno):
 
     syncaccounts = {}
     for account in activeaccounts:
+        if account not in allaccounts:
+            if len(allaccounts) == 0:
+                errormsg = 'The account "%s" does not exist because no accounts are defined!'%account
+            else:
+                errormsg = 'The account "%s" does not exist.  Valid accounts are:'%account
+                for name in allaccounts.keys():
+                    errormsg += '\n%s'%name
+            ui.terminate(1, errortitle = 'Unknown Account "%s"'%account, errormsg = errormsg)
         syncaccounts[account] = allaccounts[account]
 
     server = None