aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander_Kabui2024-09-20 11:50:47 +0300
committerAlexander_Kabui2024-09-20 11:50:47 +0300
commitd4eb237a8450e537cdaad2c87731383cf773150e (patch)
treed44a56d24367602007561b52b696f2cf505ff168
parentf7c9599ace5a4aa5783e70d54c743353533bee74 (diff)
downloadgenenetwork2-d4eb237a8450e537cdaad2c87731383cf773150e.tar.gz
Add request exception handler for gn-docs.
-rw-r--r--gn2/wqflask/api/markdown.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/gn2/wqflask/api/markdown.py b/gn2/wqflask/api/markdown.py
index f9e87ee3..5dcc546d 100644
--- a/gn2/wqflask/api/markdown.py
+++ b/gn2/wqflask/api/markdown.py
@@ -243,14 +243,20 @@ def display_blog(blog_path):
@gn_docs_blueprint.route("/blogs")
def blogs_list():
blogs = get_blogs()
-
return render_template("blogs_list.html", blogs=blogs)
@gn_docs_blueprint.errorhandler(requests.exceptions.HTTPError)
-def page_not_found(error):
- """ Return error 404 """
- return {"Reason": error.response.reason,
- "error_status_code": error.response.status_code,
- "error_msg": error.response.text
- }
+def request_exception_handler(error):
+ """Handler for gn-docs blueprint http errors"""
+ data = {
+ "error_reason": error.response.reason,
+ "error_status_code": error.response.status_code,
+ "error_msg": error.response.text,
+ }
+ return render_template(
+ "gn_docs_errors.html",
+ error_reason=error.response.reason,
+ error_msg=error.response.text,
+ error_status_code=error.response.status_code,
+ )