@@ -384,6 +384,13 @@ def find_app_config(cls, top_level_dirs):
384
384
app_config_location = full_path
385
385
return app_config_location
386
386
387
+ def format_validation_error (self , error , path ):
388
+ if error .context :
389
+ return self .format_validation_error (error .context [0 ], path )
390
+ else :
391
+ return "in {} element {}: {}" .format (
392
+ path , str ("." .join (error .absolute_path )), error .message )
393
+
387
394
def __init__ (self , tgt , top_level_dirs = None , app_config = None ):
388
395
"""Construct a mbed configuration
389
396
@@ -430,7 +437,9 @@ def __init__(self, tgt, top_level_dirs=None, app_config=None):
430
437
errors = sorted (validator .iter_errors (self .app_config_data ))
431
438
432
439
if errors :
433
- raise ConfigException ("," .join (x .message for x in errors ))
440
+ raise ConfigException ("; " .join (
441
+ self .format_validation_error (x , self .app_config_location )
442
+ for x in errors ))
434
443
435
444
# Update the list of targets with the ones defined in the application
436
445
# config, if applicable
@@ -494,7 +503,9 @@ def add_config_files(self, flist):
494
503
errors = sorted (validator .iter_errors (cfg ))
495
504
496
505
if errors :
497
- raise ConfigException ("," .join (x .message for x in errors ))
506
+ raise ConfigException ("; " .join (
507
+ self .format_validation_error (x , config_file )
508
+ for x in errors ))
498
509
499
510
cfg ["__config_path" ] = full_path
500
511
0 commit comments