Added error handlers
This commit is contained in:
+11
-1
@@ -41,4 +41,14 @@ def short_url(token):
|
||||
# Else if the query response contained data
|
||||
else:
|
||||
# Redirect to the url of the token
|
||||
return redirect(query.url)
|
||||
return redirect(query.url)
|
||||
|
||||
|
||||
# Error handling routes
|
||||
@app.errorhandler(404)
|
||||
def error_404(error):
|
||||
return render_template("error.html", error_message="404 Not Found"), 404
|
||||
|
||||
@app.errorhandler(500)
|
||||
def error_500(error):
|
||||
return render_template("error.html", error_message="500 Internal Server Error"), 500
|
||||
Reference in New Issue
Block a user