diff --git a/SAS/TMSS/client/lib/populate.py b/SAS/TMSS/client/lib/populate.py index a1eab1b2c73ad4b53c470c2ebc1d208ccb44664f..1c8e21aeca66e600289a3a5437407f90011d7e39 100644 --- a/SAS/TMSS/client/lib/populate.py +++ b/SAS/TMSS/client/lib/populate.py @@ -45,11 +45,12 @@ def populate_schemas(schema_dir: str=None, templates_filename: str=None): # load all templates and schemas and prepare them for upload. # determine the dependencies, and upload the depenends first, and the rest in parallel later. for template in templates: + with open(os.path.join(schema_dir, template['file_name'])) as schema_file: + content = schema_file.read() try: - with open(os.path.join(schema_dir, template['file_name'])) as schema_file: - json_schema = json.loads(schema_file.read()) + json_schema = json.loads(content) except Exception as e: - raise Exception("Could not decode JSON schema %s" % template['file_name']) from e + raise Exception("Could not decode JSON schema file: '%s'\n%s" % (template['file_name'], content)) from e # add template name/description/version from schema if not already in template template['name'] = template.get('name', json_schema.get('title', '<no name>'))