diff --git a/IPython/frontend/html/notebook/handlers.py b/IPython/frontend/html/notebook/handlers.py
index 62b3b8275..92752a555 100644
--- a/IPython/frontend/html/notebook/handlers.py
+++ b/IPython/frontend/html/notebook/handlers.py
@@ -30,6 +30,7 @@ from zmq.utils import jsonapi
from IPython.external.decorator import decorator
from IPython.zmq.session import Session
from IPython.lib.security import passwd_check
+from IPython.utils.jsonutil import date_default
try:
from docutils.core import publish_string
@@ -385,13 +386,13 @@ class ZMQStreamHandler(websocket.WebSocketHandler):
except KeyError:
pass
msg.pop('buffers')
- return jsonapi.dumps(msg)
+ return jsonapi.dumps(msg, default=date_default)
def _on_zmq_reply(self, msg_list):
try:
msg = self._reserialize_reply(msg_list)
- except:
- self.application.log.critical("Malformed message: %r" % msg_list)
+ except Exception:
+ self.application.log.critical("Malformed message: %r" % msg_list, exc_info=True)
else:
self.write_message(msg)