diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-31 18:02:31 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-02-01 11:41:12 -0800 |
commit | 50a2774a02993b36838e4672d395a314233c4f16 (patch) | |
tree | 3054ad17dfd6d6090bdfd9f99cbb31d8aa820fde /python/fatcat_web | |
parent | 05f985e83a9d6bfeb05b94e7ea058bb1dc360249 (diff) | |
download | fatcat-50a2774a02993b36838e4672d395a314233c4f16.tar.gz fatcat-50a2774a02993b36838e4672d395a314233c4f16.zip |
better flask error pages
Diffstat (limited to 'python/fatcat_web')
-rw-r--r-- | python/fatcat_web/routes.py | 19 | ||||
-rw-r--r-- | python/fatcat_web/templates/403.html | 15 | ||||
-rw-r--r-- | python/fatcat_web/templates/404.html | 5 | ||||
-rw-r--r-- | python/fatcat_web/templates/409.html | 13 | ||||
-rw-r--r-- | python/fatcat_web/templates/500.html | 13 | ||||
-rw-r--r-- | python/fatcat_web/templates/503.html | 12 |
6 files changed, 76 insertions, 1 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index 21f81eae..d712be01 100644 --- a/python/fatcat_web/routes.py +++ b/python/fatcat_web/routes.py @@ -429,6 +429,25 @@ def auth_account(): def page_not_found(e): return render_template('404.html'), 404 +@app.errorhandler(401) +@app.errorhandler(403) +def page_not_authorized(e): + return render_template('403.html'), 403 + +@app.errorhandler(409) +def page_edit_conflict(e): + return render_template('409.html'), 409 + +@app.errorhandler(500) +def page_server_error(e): + return render_template('500.html'), 500 + +@app.errorhandler(502) +@app.errorhandler(503) +@app.errorhandler(504) +def page_server_down(e): + return render_template('503.html'), 503 + @app.route('/', methods=['GET']) def homepage(): return render_template('home.html') diff --git a/python/fatcat_web/templates/403.html b/python/fatcat_web/templates/403.html new file mode 100644 index 00000000..14c31bb2 --- /dev/null +++ b/python/fatcat_web/templates/403.html @@ -0,0 +1,15 @@ +{% extends "base.html" %} +{% block body %} + +<center> +<div style="font-size: 8em;">403</div> +<div style="font-size: 3em;">Not Authorized</div> + +<p>You might need to log in, or your account may not (yet!) have privileges to +complete the attempted action. + +<p>This could also just mean that you need to log out and log back in. Sorry +about that! +</center> + +{% endblock %} diff --git a/python/fatcat_web/templates/404.html b/python/fatcat_web/templates/404.html index c8fbfeac..653b8eed 100644 --- a/python/fatcat_web/templates/404.html +++ b/python/fatcat_web/templates/404.html @@ -1,6 +1,9 @@ {% extends "base.html" %} {% block body %} -<h1>404: Not Found</h1> +<center> +<div style="font-size: 8em;">404</div> +<div style="font-size: 3em;">Not Found</div> +</center> {% endblock %} diff --git a/python/fatcat_web/templates/409.html b/python/fatcat_web/templates/409.html new file mode 100644 index 00000000..4f56e03e --- /dev/null +++ b/python/fatcat_web/templates/409.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} +{% block body %} + +<center> +<div style="font-size: 8em;">409</div> +<div style="font-size: 3em;">Edit Conflict</div> + +<p>Oops! Somebody else tried to edit the same resource at the same time, and +there was a conflict. You will need to resolve this manually (eg, create a new +edit from scratch). +</center> + +{% endblock %} diff --git a/python/fatcat_web/templates/500.html b/python/fatcat_web/templates/500.html new file mode 100644 index 00000000..a99232cb --- /dev/null +++ b/python/fatcat_web/templates/500.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} +{% block body %} + +<center> +<div style="font-size: 8em;">500</div> +<div style="font-size: 3em;">Internal Error</div> + +<p>Hrm, something unexpected went wrong. You may have found a bug! This request +should be logged and reported automatically; you could re-try or contact us for +more info. +</center> + +{% endblock %} diff --git a/python/fatcat_web/templates/503.html b/python/fatcat_web/templates/503.html new file mode 100644 index 00000000..f21afacc --- /dev/null +++ b/python/fatcat_web/templates/503.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} +{% block body %} + +<center> +<div style="font-size: 8em;">503</div> +<div style="font-size: 3em;">Server Error</div> + +<p>Hrm, something unexpected went wrong with a back-end service. Check the +status link below, and try again later. Apologies! +</center> + +{% endblock %} |