Commit 96d9ae5b by Sheng

Use JSONDecodeError

parent a8935079
...@@ -18,6 +18,11 @@ try: ...@@ -18,6 +18,11 @@ try:
except ImportError: except ImportError:
from tornado.concurrent import Future from tornado.concurrent import Future
try:
from json.decoder import JSONDecodeError
except ImportError:
JSONDecodeError = ValueError
DELAY = 3 DELAY = 3
...@@ -204,9 +209,7 @@ class WsockHandler(MixinHandler, tornado.websocket.WebSocketHandler): ...@@ -204,9 +209,7 @@ class WsockHandler(MixinHandler, tornado.websocket.WebSocketHandler):
worker = self.worker_ref() worker = self.worker_ref()
try: try:
msg = json.loads(message) msg = json.loads(message)
except ValueError: # py2 except JSONDecodeError:
return
except json.decoder.JSONDecodeError: # py3
return return
if not isinstance(msg, dict): if not isinstance(msg, dict):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment