diff --git a/src/caoscrawler/converters.py b/src/caoscrawler/converters.py index c8f4d2293a820d8d41f482741de7a7f2a3bf1f62..417c0b5b637b278012e6d3a16f6d4d85c0d31762 100644 --- a/src/caoscrawler/converters.py +++ b/src/caoscrawler/converters.py @@ -590,6 +590,15 @@ class MarkdownFileConverter(SimpleFileConverter): "Error during the validation (yaml header cannot be read) of the markdown file " "located at the following node in the data structure:\n" f"{path}") + except yaml_header_tools.ParseErrorsInHeader as err: + if generalStore is not None and self.name in generalStore: + path = generalStore[self.name] + else: + path = "<path not set>" + raise ConverterValidationError( + "Error during the validation (yaml header cannot be read) of the markdown file " + "located at the following node in the data structure:\n" + "{}\nError:\n{}".format(path, err)) children: List[StructureElement] = [] for name, entry in header.items(): @@ -598,8 +607,12 @@ class MarkdownFileConverter(SimpleFileConverter): elif type(entry) == str: children.append(TextElement(name, entry)) else: + if generalStore is not None and self.name in generalStore: + path = generalStore[self.name] + else: + path = "<path not set>" raise RuntimeError( - "Header entry {} has incompatible type.".format(name)) + "Header entry {} has incompatible type.\nFilename: {}".format(name, path)) return children