From 3ad1e89620972c3300448d124225e28de08d827e Mon Sep 17 00:00:00 2001 From: Jerome Petazzoni Date: Thu, 4 Apr 2019 13:21:26 -0500 Subject: [PATCH] Do not abort if a file can't be loaded; just report it and continue --- slides/markmaker.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/slides/markmaker.py b/slides/markmaker.py index a01fbe02..dd50291f 100755 --- a/slides/markmaker.py +++ b/slides/markmaker.py @@ -14,12 +14,6 @@ import yaml logging.basicConfig(level=os.environ.get("LOG_LEVEL", "INFO")) -class InvalidChapter(ValueError): - - def __init__(self, chapter): - ValueError.__init__(self, "Invalid chapter: {!r}".format(chapter)) - - def anchor(title): title = title.lower().replace(' ', '-') title = ''.join(c for c in title if c in string.ascii_letters+'-') @@ -175,7 +169,8 @@ def processchapter(chapter, filename): markdown = "\n---\n".join(c[0] for c in chapters) titles = [t for (m,t) in chapters if t] return (markdown, titles) - raise InvalidChapter(chapter) + logging.warning("Invalid chapter: {}".format(chapter)) + return "```\nInvalid chapter: {}\n```\n".format(chapter), [] # Try to figure out the URL of the repo on GitHub. # This is used to generate "edit me on GitHub"-style links.