summaryrefslogtreecommitdiff
path: root/alot/settings
diff options
context:
space:
mode:
authorJulian Mehne <julian.mehne@posteo.de>2017-12-03 10:29:04 +0100
committerJulian Mehne <julian.mehne@posteo.de>2017-12-06 14:28:24 +0100
commitb9ae81a590eee4ab3f601a5edc1ea3f451c39c66 (patch)
treef04a0d25554247eb16cfdcaa40577e709cd6d041 /alot/settings
parent4501d073407be97fdf4206bec853ea0ec1e5351b (diff)
Give more context if reading of config file fails.
Diffstat (limited to 'alot/settings')
-rw-r--r--alot/settings/utils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/alot/settings/utils.py b/alot/settings/utils.py
index d87157c3..242fa63c 100644
--- a/alot/settings/utils.py
+++ b/alot/settings/utils.py
@@ -3,6 +3,8 @@
# For further details see the COPYING file
from __future__ import absolute_import
+import logging
+
from configobj import ConfigObj, ConfigObjError, flatten_errors
from validate import Validator
from urwid import AttrSpec
@@ -30,7 +32,9 @@ def read_config(configpath=None, specpath=None, checks=None):
config = ConfigObj(infile=configpath, configspec=specpath,
file_error=True, encoding='UTF8')
except ConfigObjError as e:
- raise ConfigError(e)
+ msg = 'Error when parsing `%s`:\n%s' % (configpath, e)
+ logging.error(msg)
+ raise ConfigError(msg)
except IOError:
raise ConfigError('Could not read %s and/or %s'
% (configpath, specpath))