Skip to content
Snippets Groups Projects
Commit 5a4c4425 authored by Steven Loria's avatar Steven Loria
Browse files

Default error code to 500

[fixes #18]
parent e3286524
No related branches found
No related tags found
No related merge requests found
...@@ -48,7 +48,9 @@ def register_blueprints(app): ...@@ -48,7 +48,9 @@ def register_blueprints(app):
def register_errorhandlers(app): def register_errorhandlers(app):
def render_error(error): def render_error(error):
return render_template("{0}.html".format(error.code)), error.code # If a HTTPException, pull the `code` attribute; default to 500
error_code = getattr(error, 'code', 500)
return render_template("{0}.html".format(error_code)), error_code
for errcode in [401, 404, 500]: for errcode in [401, 404, 500]:
app.errorhandler(errcode)(render_error) app.errorhandler(errcode)(render_error)
return None return None
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment