Changed the way error messages are displayed
This commit is contained in:
+3
-3
@@ -37,7 +37,7 @@ def short_url(token):
|
|||||||
# If the query response was empty
|
# If the query response was empty
|
||||||
if not query:
|
if not query:
|
||||||
# Return the error page with a 404 not found error
|
# Return the error page with a 404 not found error
|
||||||
return render_template("error.html", error_message="404 Not Found"), 404
|
return render_template("error.html", error_code=404, error_message="Not Found"), 404
|
||||||
|
|
||||||
# Else if the query response contained data
|
# Else if the query response contained data
|
||||||
else:
|
else:
|
||||||
@@ -52,8 +52,8 @@ def donate():
|
|||||||
# Error handling routes
|
# Error handling routes
|
||||||
@app.errorhandler(404)
|
@app.errorhandler(404)
|
||||||
def error_404(error):
|
def error_404(error):
|
||||||
return render_template("error.html", error_message="404 Not Found"), 404
|
return render_template("error.html", error_code=404, error_message="Not Found"), 404
|
||||||
|
|
||||||
@app.errorhandler(500)
|
@app.errorhandler(500)
|
||||||
def error_500(error):
|
def error_500(error):
|
||||||
return render_template("error.html", error_message="500 Internal Server Error"), 500
|
return render_template("error.html", error_code=500, error_message="Internal Server Error"), 500
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ body {
|
|||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 100%;
|
font-size: 100%;
|
||||||
margin: 1.5% 0 0 0;
|
margin: 2vh 0 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-message {
|
.error-message {
|
||||||
|
|||||||
@@ -7,8 +7,9 @@
|
|||||||
<h1 class="desc">Custom URL Shortener</h1>
|
<h1 class="desc">Custom URL Shortener</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="error-message">
|
<ul class="error-message">
|
||||||
<h1>{{ error_message }}</h1>
|
<li><h1>{{ error_code }}</h1></li>
|
||||||
</div>
|
<li><h1>{{ error_message }}</h1></li>
|
||||||
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<form method="POST" action="">
|
<form method="POST" action="">
|
||||||
{{ form.hidden_tag() }}
|
{{ form.hidden_tag() }}
|
||||||
<div class="inputs">
|
<div class="inputs">
|
||||||
{{ form.url(placeholder="Enter the URL here", class="url") }}
|
{{ form.url(placeholder="Enter the URL here", autofocus=true, class="url") }}
|
||||||
{{ form.submit(class="button") }}
|
{{ form.submit(class="button") }}
|
||||||
</div>
|
</div>
|
||||||
{% if form.url.errors %}
|
{% if form.url.errors %}
|
||||||
|
|||||||
Reference in New Issue
Block a user