Add error catching for YAML parsing

Signed-off-by: Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com>
This commit is contained in:
Thomas A. Christensen II 2022-01-25 10:14:59 -06:00
parent 48c2d7a151
commit 54dc67b0d3

View file

@ -161,7 +161,11 @@ class NFDocs(Directive):
doc_yaml = ""
for i in pos:
doc_yaml = doc_yaml + nextflow_lines[i].replace(self.DOC_STARTER, "")
docstrings[proc_type][proc_name] = yaml.safe_load(doc_yaml)
try:
docstrings[proc_type][proc_name] = yaml.safe_load(doc_yaml)
except:
logger = logging.getLogger(__name__)
logger.warning(f"Could not parse YAML for {proc_name}")
# Try to convert each definition to a node
for block_type, block_docs in docstrings.items():
@ -206,5 +210,5 @@ class NFDocs(Directive):
def setup(app):
app.add_directive('nfdocs', NFDocs)
return {
"version": "0.1.1"
"version": "0.1.2"
}