1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-31 18:21:14 +00:00

boostrap: nicer error messages on config parasing.

- handle ValueError as well as SyntaxError from config parser
- Report source file in the error message
This commit is contained in:
Sergei Trofimov 2016-04-14 16:18:31 +01:00
parent ec85f9f8a0
commit b6c0e2e4fd

View File

@ -114,8 +114,8 @@ class ConfigLoader(object):
new_config = load_struct_from_yaml(source)
else:
raise ConfigError('Unknown config format: {}'.format(source))
except LoadSyntaxError as e:
raise ConfigError(e)
except (LoadSyntaxError, ValueError) as e:
raise ConfigError('Invalid config "{}":\n\t{}'.format(source, e))
self._config = merge_dicts(self._config, new_config,
list_duplicates='first',