Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions hed/errors/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class HedExceptions:
CANNOT_PARSE_XML = 'cannotParseXML'
CANNOT_PARSE_JSON = 'cannotParseJson'
INVALID_EXTENSION = 'invalidExtension'
INVALID_HED_FORMAT = 'INVALID_HED_FORMAT'

INVALID_DATAFRAME = 'INVALID_DATAFRAME'
INVALID_FILE_FORMAT = 'INVALID_FILE_FORMAT'
Expand Down
2 changes: 1 addition & 1 deletion hed/schema/schema_io/wiki2schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ def _add_fatal_error(self, line_number, line, warning_message="Schema term is em
{'code': error_code,
ErrorContext.ROW: line_number,
ErrorContext.LINE: line,
"message": f"ERROR: {warning_message}"
"message": f"{error_code}: {warning_message}"
}
)

Expand Down
3 changes: 3 additions & 0 deletions hed/schema/schema_io/xml2schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ def _parse_sections(self, root_element, parse_order):
section_element = self._get_elements_by_name(section_name, root_element)
if section_element:
section_element = section_element[0]
if isinstance(section_element, list):
raise HedFileError(HedExceptions.INVALID_HED_FORMAT,
"Attempting to load an outdated or invalid XML schema", self.filename)
parse_func = parse_order[section_key]
parse_func(section_element)

Expand Down