|
15 | 15 | limitations under the License.
|
16 | 16 | """
|
17 | 17 |
|
| 18 | +import os |
| 19 | +import sys |
| 20 | + |
18 | 21 | # Implementation of mbed configuration mechanism
|
19 | 22 | from tools.utils import json_file_to_dict
|
20 | 23 | from tools.targets import Target
|
21 |
| -import os |
22 | 24 |
|
23 | 25 | # Base class for all configuration exceptions
|
24 | 26 | class ConfigException(Exception):
|
@@ -376,8 +378,12 @@ def __init__(self, target, top_level_dirs=None):
|
376 | 378 | app_config_location, full_path))
|
377 | 379 | else:
|
378 | 380 | app_config_location = full_path
|
379 |
| - self.app_config_data = json_file_to_dict(app_config_location) \ |
380 |
| - if app_config_location else {} |
| 381 | + try: |
| 382 | + self.app_config_data = json_file_to_dict(app_config_location) \ |
| 383 | + if app_config_location else {} |
| 384 | + except ValueError as exc: |
| 385 | + sys.stderr.write(str(exc) + "\n") |
| 386 | + self.app_config_data = {} |
381 | 387 | # Check the keys in the application configuration data
|
382 | 388 | unknown_keys = set(self.app_config_data.keys()) - \
|
383 | 389 | self.__allowed_keys["application"]
|
@@ -419,7 +425,12 @@ def add_config_files(self, flist):
|
419 | 425 | self.processed_configs[full_path] = True
|
420 | 426 | # Read the library configuration and add a "__full_config_path"
|
421 | 427 | # attribute to it
|
422 |
| - cfg = json_file_to_dict(config_file) |
| 428 | + try: |
| 429 | + cfg = json_file_to_dict(config_file) |
| 430 | + except ValueError as exc: |
| 431 | + sys.stderr.write(str(exc) + "\n") |
| 432 | + continue |
| 433 | + |
423 | 434 | cfg["__config_path"] = full_path
|
424 | 435 |
|
425 | 436 | if "name" not in cfg:
|
|
0 commit comments