Skip to content

Commit 96fbe3e

Browse files
authored
Merge Custom Error Pages (#200)
2 parents 8854901 + d8244e3 commit 96fbe3e

File tree

6 files changed

+56
-1
lines changed

6 files changed

+56
-1
lines changed

frontend/scss/components/code.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pre{
2+
white-space: pre-wrap;
3+
}

frontend/scss/packet.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ $csh-pink: #b0197e;
77
@import "components/buttons";
88
@import "components/signatures";
99
@import "components/badges";
10+
@import "components/code";

packet/routes/shared.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,17 @@ def service_worker():
8080
@app.route('/OneSignalSDKUpdaterWorker.js', methods=['GET'])
8181
def update_service_worker():
8282
return app.send_static_file('js/update-sw.js')
83+
84+
85+
@app.errorhandler(404)
86+
@packet_auth
87+
@before_request
88+
def not_found(e, info=None):
89+
return render_template('not_found.html', e=e, info=info), 404
90+
91+
92+
@app.errorhandler(500)
93+
@packet_auth
94+
@before_request
95+
def error(e, info=None):
96+
return render_template('error.html', e=e, info=info), 500

packet/templates/error.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{% extends 'extend/base.html' %}
2+
3+
{% block body %}
4+
<div class="container main">
5+
<h1 class="card-title">Oops!</h1>
6+
<div class="card mb-3">
7+
<div class="card-body" style="text-align: left;">
8+
<h5 class="card-text">
9+
I guess this is what you get when you trust a bunch of college kids.
10+
</h5>
11+
<p class="card-text">
12+
<pre><code>{{ e }}</code></pre>
13+
</p>
14+
<h5 class="card-text">
15+
Do us a favor, try again. If you end up here on the second try, <a href="mailto:[email protected]">shoot us an email</a>.
16+
</h5>
17+
</div>
18+
</div>
19+
</div>
20+
{% endblock %}

packet/templates/not_found.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{% extends 'extend/base.html' %}
2+
3+
{% block body %}
4+
<div class="container main">
5+
<h1 class="card-title">Page Not Found</h1>
6+
<div class="card mb-3">
7+
<div class="card-body" style="text-align: left;">
8+
<h4 class="card-text">
9+
Not sure what you're looking for, but it's not here.
10+
</h4>
11+
<h5 class="card-text">
12+
Do us a favor, check your spelling. If you can't find what you're looking for, <a href="mailto:[email protected]">shoot us an email</a>.
13+
</h5>
14+
</div>
15+
</div>
16+
</div>
17+
{% endblock %}

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ gunicorn~=19.7.1
1010
csh_ldap~=2.1.0
1111
onesignal-sdk~=1.0.0
1212
pylint-quotes~=0.2.1
13-
sentry-sdk==0.13.1
13+
sentry-sdk~=0.14.2

0 commit comments

Comments
 (0)