Skip to content

Raise error when mbed_app.json is bad #4098

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions tools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ def __init__(self, tgt, top_level_dirs=None, app_config=None):
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 []:
Expand All @@ -399,8 +400,10 @@ def __init__(self, tgt, top_level_dirs=None, app_config=None):
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()) - \
Expand Down Expand Up @@ -433,7 +436,7 @@ def __init__(self, tgt, top_level_dirs=None, app_config=None):

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
Expand Down Expand Up @@ -806,6 +809,7 @@ def load_resources(self, resources):
"""
# 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
Expand Down