diff options
author | Anish Athalye <me@anishathalye.com> | 2015-04-24 18:34:51 -0400 |
---|---|---|
committer | Anish Athalye <me@anishathalye.com> | 2015-04-24 18:34:51 -0400 |
commit | 3a649c11128e657a02fb79fce4bc7a039ee0dfe0 (patch) | |
tree | 98eec834aa9df68373c6a10d570b75001c4f75d1 /dotbot | |
parent | fd08ddacd34530186f3954b435d4dd90b5b9471f (diff) | |
parent | 56d8d05e777e3831b9a0fab0bbdd45af72185b9f (diff) |
Merge branch 'joshblum/config-logging'
Diffstat (limited to 'dotbot')
-rw-r--r-- | dotbot/config.py | 6 | ||||
-rw-r--r-- | dotbot/util/string.py | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/dotbot/config.py b/dotbot/config.py index 49252d8..a6ee9da 100644 --- a/dotbot/config.py +++ b/dotbot/config.py @@ -1,4 +1,5 @@ import yaml +from .util import string class ConfigReader(object): def __init__(self, config_file_path): @@ -9,8 +10,9 @@ class ConfigReader(object): with open(config_file_path) as fin: data = yaml.load(fin) return data - except Exception: - raise ReadingError('Could not read config file') + except Exception as e: + msg = string.indent_lines(str(e)) + raise ReadingError('Could not read config file:\n%s' % msg) def get_config(self): return self._config diff --git a/dotbot/util/string.py b/dotbot/util/string.py new file mode 100644 index 0000000..2a19b10 --- /dev/null +++ b/dotbot/util/string.py @@ -0,0 +1,4 @@ +def indent_lines(string, amount=2, delimiter='\n'): + whitespace = ' ' * amount + sep = '%s%s' % (delimiter, whitespace) + return '%s%s' % (whitespace, sep.join(string.split(delimiter))) |