From 54dc67b0d302fedb6f6e64fef1f3e9eb58652491 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Tue, 25 Jan 2022 10:14:59 -0600 Subject: [PATCH] Add error catching for YAML parsing Signed-off-by: Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com> --- nfdocs-parser.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nfdocs-parser.py b/nfdocs-parser.py index b7e2ffe..ba38c51 100755 --- a/nfdocs-parser.py +++ b/nfdocs-parser.py @@ -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" }