Adding error handlers for 400 and 405
This commit is contained in:
parent
cb10a06183
commit
6cda07e58a
3 changed files with 21 additions and 0 deletions
0
src/templates/400.html
Normal file
0
src/templates/400.html
Normal file
10
src/templates/405.html
Normal file
10
src/templates/405.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
{% extends "root.html" %}
|
||||
{% block title %}FOTB - 405 :({% endblock %}
|
||||
|
||||
{% block main %}
|
||||
{{ super() }}
|
||||
<div class="text-center">
|
||||
<h1>405</h1>
|
||||
<h2>Method not allowed!</h2>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -24,6 +24,17 @@ error_pages = flask.Blueprint('error_pages', __name__, template_folder='template
|
|||
def page_not_found_error(e):
|
||||
return flask.render_template("404.html"), 404
|
||||
|
||||
|
||||
@error_pages.app_errorhandler(500)
|
||||
def internal_server_error(e):
|
||||
return flask.render_template("500.html"), 500
|
||||
|
||||
|
||||
@error_pages.app_errorhandler(405)
|
||||
def method_not_allowed_error(e):
|
||||
return flask.render_template("405.html"), 405
|
||||
|
||||
|
||||
@error_pages.app_errorhandler(400)
|
||||
def bad_request_error(e):
|
||||
return flask.render_template("400.html"), 400
|
||||
|
|
Loading…
Reference in a new issue