diff --git a/tools/config.py b/tools/config.py index 16ba893b0d..19b361bf3e 100644 --- a/tools/config.py +++ b/tools/config.py @@ -384,6 +384,7 @@ class Config(object): top_level_dirs may be None (in this case, the constructor will not search for a configuration file). """ + config_errors = [] app_config_location = app_config if app_config_location is None: for directory in top_level_dirs or []: @@ -399,8 +400,10 @@ class Config(object): self.app_config_data = json_file_to_dict(app_config_location) \ if app_config_location else {} except ValueError as exc: - sys.stderr.write(str(exc) + "\n") self.app_config_data = {} + config_errors.append( + ConfigException("Could not parse mbed app configuration from %s" + % app_config_location)) # Check the keys in the application configuration data unknown_keys = set(self.app_config_data.keys()) - \ @@ -433,7 +436,7 @@ class Config(object): self._process_config_and_overrides(self.app_config_data, {}, "app", "application") - self.config_errors = None + self.config_errors = config_errors def add_config_files(self, flist): """Add configuration files @@ -806,6 +809,7 @@ class Config(object): """ # Update configuration files until added features creates no changes prev_features = set() + self.validate_config() while True: # Add/update the configuration with any .json files found while # scanning