Skip to content
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
19 changes: 15 additions & 4 deletions tools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
limitations under the License.
"""

import os
import sys

# Implementation of mbed configuration mechanism
from tools.utils import json_file_to_dict
from tools.targets import Target
import os

# Base class for all configuration exceptions
class ConfigException(Exception):
Expand Down Expand Up @@ -376,8 +378,12 @@ def __init__(self, target, top_level_dirs=None):
app_config_location, full_path))
else:
app_config_location = full_path
self.app_config_data = json_file_to_dict(app_config_location) \
if app_config_location else {}
try:
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 = {}
# Check the keys in the application configuration data
unknown_keys = set(self.app_config_data.keys()) - \
self.__allowed_keys["application"]
Expand Down Expand Up @@ -419,7 +425,12 @@ def add_config_files(self, flist):
self.processed_configs[full_path] = True
# Read the library configuration and add a "__full_config_path"
# attribute to it
cfg = json_file_to_dict(config_file)
try:
cfg = json_file_to_dict(config_file)
except ValueError as exc:
sys.stderr.write(str(exc) + "\n")
continue

cfg["__config_path"] = full_path

if "name" not in cfg:
Expand Down