1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-20 20:09:11 +00:00

fw/config: better message on config setting error

Catch exceptions raised when attempting to set value of a config point,
and re-raise as ConfigError with name associated with the value in the
config file.
This commit is contained in:
Sergei Trofimov 2018-03-22 12:15:43 +00:00 committed by Marc Bonnici
parent 67ea7c8ee1
commit 3d7984412a

View File

@ -371,8 +371,13 @@ class Configuration(object):
if name not in self.configuration:
raise ConfigError('Unknown {} configuration "{}"'.format(self.name,
name))
self.configuration[name].set_value(self, value,
check_mandatory=check_mandatory)
try:
self.configuration[name].set_value(self, value,
check_mandatory=check_mandatory)
except (TypeError, ValueError, ConfigError) as e:
msg = 'Invalid value "{}" for "{}": {}'
raise ConfigError(msg.format(value, name, e))
def update_config(self, values, check_mandatory=True):
for k, v in values.iteritems():