Add error message when general section is missing

Fix #43
Fix #45
This commit is contained in:
Markus Unterwaditzer 2014-05-02 13:15:52 +02:00
parent b832d7423f
commit 3e7bb377cc

View file

@ -33,6 +33,7 @@ def load_config(fname, pair_options=('collections', 'conflict_resolution')):
get_options = lambda s: dict(parse_options(c.items(s), section=s))
general = None
pairs = {}
storages = {}
@ -55,6 +56,12 @@ def load_config(fname, pair_options=('collections', 'conflict_resolution')):
cli_logger.error(
'Unknown section in {}: {}'.format(fname, section))
if not general:
cli_logger.error('Unable to find general section. You should copy the '
'example config from the repository and edit it.')
cli_logger.error('https://github.com/untitaker/vdirsyncer')
sys.exit(1)
return general, pairs, storages