From 2115fcfde74375252f556153d48f52f4d15fb298 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sun, 2 Oct 2016 12:02:46 +0000 Subject: Error page: trim error messages --- wqflask/wqflask/templates/error.html | 6 +++++- wqflask/wqflask/views.py | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/wqflask/wqflask/templates/error.html b/wqflask/wqflask/templates/error.html index 95485f1e..7ab2bf2f 100644 --- a/wqflask/wqflask/templates/error.html +++ b/wqflask/wqflask/templates/error.html @@ -25,11 +25,15 @@ to reproduce this ERROR. Next to those steps, copy-paste below stack trace, either as a new - issue (GeneNetwork error: {{message}}) or E-mail this full page to one of the developers + issue or E-mail this full page to one of the developers directly.
++ (GeneNetwork error: {{message[:128]}}) +
+{{ stack[0] }} {{ message }} (error) diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 7abcc17d..cf316bee 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -103,7 +103,7 @@ def handle_bad_request(e): # Handle random animations # Use a cookie to have one animation on refresh - animation = request.cookies.get(err_msg) + animation = request.cookies.get(err_msg[:64]) if not animation: list = [fn for fn in os.listdir("./wqflask/static/gif/error") if fn.endswith(".gif") ] animation = random.choice(list) @@ -111,7 +111,7 @@ def handle_bad_request(e): resp = make_response(render_template("error.html",message=err_msg,stack=formatted_lines,error_image=animation)) # logger.error("Set cookie %s with %s" % (err_msg, animation)) - resp.set_cookie(err_msg,animation) + resp.set_cookie(err_msg[:64],animation) return resp @app.route("/") -- cgit v1.2.3