From a8a04a7ce3f1cded64f2ab497d450bb9a1cd45a3 Mon Sep 17 00:00:00 2001 From: Sebb Date: Thu, 4 May 2023 23:22:01 +0100 Subject: [PATCH] Don't catch BaseException --- bin/buildsite.py | 4 ++-- plugins/md_inline_extension/inline.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/buildsite.py b/bin/buildsite.py index b83de51..9ab1fed 100755 --- a/bin/buildsite.py +++ b/bin/buildsite.py @@ -141,7 +141,7 @@ def start_build(args): f.write(""" try: PLUGINS += ['toc'] -except: +except Exception: # TODO: narrow further to expected Exceptions PLUGINS = ['toc', 'gfm'] """) @@ -179,7 +179,7 @@ def start_build(args): print("- Doing fresh checkout of branch %s" % args.outputbranch) subprocess.run((GIT, 'checkout', args.outputbranch, '-f'), check=True) subprocess.run((GIT, 'pull'), check=True) - except: + except Exception: # TODO: narrow further to expected Exceptions print("- Branch %s does not exist (yet), creating it..." % args.outputbranch) # If .asf.yaml exists, which it should, make a copy of it in memory for later asfyml = os.path.join(sourcepath, '.asf.yaml') diff --git a/plugins/md_inline_extension/inline.py b/plugins/md_inline_extension/inline.py index 0d73b0b..049cbbf 100644 --- a/plugins/md_inline_extension/inline.py +++ b/plugins/md_inline_extension/inline.py @@ -27,7 +27,7 @@ def process_settings(pelicanobj): # Get the user specified settings try: settings = pelicanobj.settings['MD_INLINE'] - except: + except Exception: # TODO: narrow further to expected Exceptions settings = None # If settings have been specified, add them to the config @@ -45,7 +45,7 @@ def inline_markdown_extension(pelicanobj, config): pelicanobj.settings['MD_EXTENSIONS'].append(PelicanInlineMarkdownExtension(config)) else: pelicanobj.settings['MARKDOWN'].setdefault('extensions', []).append(PelicanInlineMarkdownExtension(config)) - except: + except Exception: # TODO: narrow further to expected Exceptions sys.excepthook(*sys.exc_info()) sys.stderr.write("\nError - the pelican Markdown extension failed to configure. Inline Markdown extension is non-functional.\n") sys.stderr.flush()