diff options
author | Alexander_Kabui | 2024-09-20 11:50:47 +0300 |
---|---|---|
committer | Alexander_Kabui | 2024-09-20 11:50:47 +0300 |
commit | d4eb237a8450e537cdaad2c87731383cf773150e (patch) | |
tree | d44a56d24367602007561b52b696f2cf505ff168 /gn2 | |
parent | f7c9599ace5a4aa5783e70d54c743353533bee74 (diff) | |
download | genenetwork2-d4eb237a8450e537cdaad2c87731383cf773150e.tar.gz |
Add request exception handler for gn-docs.
Diffstat (limited to 'gn2')
-rw-r--r-- | gn2/wqflask/api/markdown.py | 20 |
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, + ) |