From 48c2d7a15133bba60ff3b092d8fcdd0208b2aa4d Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Tue, 25 Jan 2022 10:11:33 -0600 Subject: [PATCH] Add error catching Signed-off-by: Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com> --- nfdocs-parser.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/nfdocs-parser.py b/nfdocs-parser.py index f4c1ab7..b7e2ffe 100755 --- a/nfdocs-parser.py +++ b/nfdocs-parser.py @@ -5,6 +5,7 @@ import yaml from docutils import nodes from docutils.parsers.rst import Directive from docutils.parsers.rst import directives +from sphinx.util import logging def definition_type(signature): # Returns "name", workflow|process|function @@ -175,17 +176,22 @@ class NFDocs(Directive): # Create a subsection for each block for proc_name, proc_docs in sorted_block_docs.items(): - # Create the section and heading - proc_section = nodes.section() - proc_section += nodes.title(text=proc_name) - proc_section += nodes.paragraph(text=proc_docs["summary"]) + try: + # Create the section and heading + proc_section = nodes.section() + proc_section += nodes.title(text=proc_name) + proc_section += nodes.paragraph(text=proc_docs["summary"]) + + # Create the io tables + io_methods = ["input", "output"] + for met in io_methods: + if met in proc_docs.keys(): + io_table = self.params_to_table(met, proc_docs[met]) + proc_section += io_table + except: + logger = logging.getLogger(__name__) + logger.warning(f"Could not write docs for {proc_name}") - # Create the io tables - io_methods = ["input", "output"] - for met in io_methods: - if met in proc_docs.keys(): - io_table = self.params_to_table(met, proc_docs[met]) - proc_section += io_table # Add the block section to the parent node self.state_machine.document.note_implicit_target(proc_section) @@ -200,5 +206,5 @@ class NFDocs(Directive): def setup(app): app.add_directive('nfdocs', NFDocs) return { - "version": "0.1.0" + "version": "0.1.1" }