From 893c30d2dc8a16bea53e683f4903b83879b9d08f Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Mon, 23 Dec 2013 17:33:46 -0500 Subject: [PATCH] Improve log message for invalid unicode. Truncate long values, and include the argument name if available. --- tornado/web.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tornado/web.py b/tornado/web.py index 915ddb9d9..2f7e92ea0 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -450,7 +450,8 @@ class RequestHandler(object): try: return _unicode(value) except UnicodeDecodeError: - raise HTTPError(400, "Invalid unicode: %r" % value) + raise HTTPError(400, "Invalid unicode in %s: %r" % + (name or "url", value[:40])) @property def cookies(self): -- 2.47.2