File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -160,10 +160,22 @@ def main():
160160 try :
161161 validate (args .yaml_file_name )
162162 except SchemaValidationError as e :
163+ if e .absolute_path :
164+ # construct a path to the error location inside the YAML file
165+ path = list (e .absolute_path )
166+ path = (
167+ path [0 ] + "" .join (f"[{ str (p )} ]" for p in path [1 :]) + ": "
168+ )
169+ else :
170+ path = ""
163171 logger .error (
164- f"Provided YAML file does not adhere to PEtab schema: { e } "
172+ "Provided YAML file does not adhere to PEtab schema: "
173+ f"{ path } { e .args [0 ]} "
165174 )
166175 sys .exit (1 )
176+ except ValueError as e :
177+ logger .error (e )
178+ sys .exit (1 )
167179
168180 if petab .is_composite_problem (args .yaml_file_name ):
169181 # TODO: further checking:
Original file line number Diff line number Diff line change @@ -77,16 +77,14 @@ def validate_yaml_syntax(
7777 # but let's still use the latest PEtab schema for full validation
7878 version = yaml_config .get (FORMAT_VERSION , None )
7979 version = (
80- parse_version (version )[:2 ]
81- if version
82- else list (SCHEMAS .values ())[- 1 ]
80+ parse_version (version )[:2 ] if version else list (SCHEMAS .keys ())[- 1 ]
8381 )
8482
8583 try :
8684 schema = SCHEMAS [version ]
8785 except KeyError as e :
8886 raise ValueError (
89- "Unknown PEtab version given in problem "
87+ "No or unknown PEtab version given in problem "
9088 f"specification: { version } "
9189 ) from e
9290 schema = load_yaml (schema )
You can’t perform that action at this time.
0 commit comments