summaryrefslogtreecommitdiffstats
path: root/fatcat_scholar/templates
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-01-14 19:06:00 -0800
committerBryan Newbold <bnewbold@archive.org>2021-01-14 19:06:00 -0800
commit866077830070739191e7e21bc471870efd8bb9bf (patch)
tree4250dc82e043817a2784d21367bedf6b2aa60579 /fatcat_scholar/templates
parent2bf5319193e31b3ccf3e8f467e7ea3e07897a56b (diff)
downloadfatcat-scholar-866077830070739191e7e21bc471870efd8bb9bf.tar.gz
fatcat-scholar-866077830070739191e7e21bc471870efd8bb9bf.zip
fastapi: add basic error/exception handler and page
Diffstat (limited to 'fatcat_scholar/templates')
-rw-r--r--fatcat_scholar/templates/error.html31
1 files changed, 31 insertions, 0 deletions
diff --git a/fatcat_scholar/templates/error.html b/fatcat_scholar/templates/error.html
new file mode 100644
index 0000000..2eafa8d
--- /dev/null
+++ b/fatcat_scholar/templates/error.html
@@ -0,0 +1,31 @@
+{% extends "base.html" %}
+
+{% block title %}
+{{ error.status_code }} - {{ super() }}
+{% endblock %}
+
+{% block main %}
+<center>
+ <div style="font-size: 8em;">{{ error.status_code }}</div>
+ <div style="font-size: 3em;">
+ {% if error.status_code == 404 %}
+ {% trans %}Not Found{% endtrans %}
+ {% elif error.status_code == 403 %}
+ {% trans %}Access Forbidden{% endtrans %}
+ {% elif error.status_code == 400 %}
+ {% trans %}Request Error{% endtrans %}
+ {% elif error.status_code > 500 and error.status_code < 600 %}
+ {% trans %}Internal Error{% endtrans %}
+ {% endif %}
+ </div>
+</center>
+{% if error.detail and error.detail not in ["Not Found", "Server Error", "Bad Request"] %}
+ <div class="ui icon error message">
+ <i class="ban icon"></i>
+ <div class="content">
+ <div class="header"></div>
+ <p>{{ error.detail }}
+ </div>
+ </div>
+{% endif %}
+{% endblock %}