aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBonfaceKilz2021-11-23 16:12:27 +0300
committerBonfaceKilz2021-11-23 17:44:24 +0300
commitc398af6b98f89917065457153b0f7e55be28e835 (patch)
tree8e5b31d6705bd6623c8255c8a7a021f36e61b5bb
parentfcfd7be522ce914b0aa11cd4555aeab2d2141428 (diff)
downloadgenenetwork2-c398af6b98f89917065457153b0f7e55be28e835.tar.gz
wqflask: views: Make error messages properly formatted
-rw-r--r--wqflask/wqflask/views.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 2cbaffd6..55d9ebbe 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -131,9 +131,8 @@ def handle_generic_exceptions(e):
time_str = now.strftime('%l:%M%p UTC %b %d, %Y')
# get the stack trace and send it to the logger
exc_type, exc_value, exc_traceback = sys.exc_info()
- formatted_lines = {f"{request.url} ({time_str}) "
- f" {traceback.format_exc().splitlines()}"}
-
+ formatted_lines = (f"{request.url} ({time_str}) \n"
+ f"{traceback.format_exc()}")
_message_templates = {
werkzeug.exceptions.NotFound: ("404: Not Found: "
f"{time_str}: {request.url}"),
@@ -142,8 +141,8 @@ def handle_generic_exceptions(e):
werkzeug.exceptions.RequestTimeout: ("408: Request Timeout: "
f"{time_str}: {request.url}")}
# Default to the lengthy stack trace!
- logger.error(_message_templates.get(exc_type,
- formatted_lines))
+ app.logger.error(_message_templates.get(exc_type,
+ formatted_lines))
# Handle random animations
# Use a cookie to have one animation on refresh
animation = request.cookies.get(err_msg[:32])
@@ -152,7 +151,7 @@ def handle_generic_exceptions(e):
"./wqflask/static/gif/error") if fn.endswith(".gif")])
resp = make_response(render_template("error.html", message=err_msg,
- stack=formatted_lines,
+ stack={formatted_lines},
error_image=animation,
version=GN_VERSION))