]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Improve log message for invalid unicode.
authorBen Darnell <ben@bendarnell.com>
Mon, 23 Dec 2013 22:33:46 +0000 (17:33 -0500)
committerBen Darnell <ben@bendarnell.com>
Mon, 23 Dec 2013 22:33:46 +0000 (17:33 -0500)
Truncate long values, and include the argument name if available.

tornado/web.py

index 915ddb9d92b59dda4db831c988f109177d4f951f..2f7e92ea09e11f96d6aa86c37e73656f6e983191 100644 (file)
@@ -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):