From f48078c83ab445c4f320ff993717622b95ede257 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 4 Jun 2020 10:51:06 -0700 Subject: [PATCH] Send 404 instead of 500 for FileNotFoundError. --- voussoir.net/writing/vmarkdown.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/voussoir.net/writing/vmarkdown.py b/voussoir.net/writing/vmarkdown.py index bef0189..dc64862 100644 --- a/voussoir.net/writing/vmarkdown.py +++ b/voussoir.net/writing/vmarkdown.py @@ -664,7 +664,10 @@ def markdown_flask(core_filename, port, *args, **kwargs): return response def do_md_for(filename): - html = markdown(md=cat_file(filename), *args, **kwargs) + try: + html = markdown(md=cat_file(filename), *args, **kwargs) + except FileNotFoundError: + flask.abort(404) refresh = request.args.get('refresh', None) if refresh is not None: refresh = 1000 * max(float(refresh), 1)