Send 404 instead of 500 for FileNotFoundError.

This commit is contained in:
Ethan Dalool 2020-06-04 10:51:06 -07:00
parent 21cd407070
commit f48078c83a

View file

@ -664,7 +664,10 @@ def markdown_flask(core_filename, port, *args, **kwargs):
return response return response
def do_md_for(filename): 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) refresh = request.args.get('refresh', None)
if refresh is not None: if refresh is not None:
refresh = 1000 * max(float(refresh), 1) refresh = 1000 * max(float(refresh), 1)