aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimov <sergei.trofimov@arm.com>2018-03-22 12:15:43 +0000
committerMarc Bonnici <marc.bonnici@arm.com>2018-03-22 12:28:48 +0000
commit3d7984412a5bd1a890057bbac629469a2376efb5 (patch)
tree805dcc950a70977ba5c0d2fec17adf3c72dc6e62
parent67ea7c8ee19cd97517b1aab1e7a939ebfa3d5aa8 (diff)
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.
-rw-r--r--wa/framework/configuration/core.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/wa/framework/configuration/core.py b/wa/framework/configuration/core.py
index 09740b45..3a7a2f92 100644
--- a/wa/framework/configuration/core.py
+++ b/wa/framework/configuration/core.py
@@ -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():