From c7894a01f01217ccb51d5659b7dff0da13047359 Mon Sep 17 00:00:00 2001 From: Daniel Burrows Date: Fri, 1 Dec 2006 11:54:25 +0100 Subject: [PATCH] Instead of blowing up when the account name is missing, display a useful error message that gives the correct account names. --- offlineimap/init.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/offlineimap/init.py b/offlineimap/init.py index 45a5773..0780988 100644 --- a/offlineimap/init.py +++ b/offlineimap/init.py @@ -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