From: Ben Darnell Date: Thu, 6 Jun 2013 01:57:03 +0000 (-0400) Subject: Document websocket error handling change (and StreamClosedError). X-Git-Tag: v3.1.0~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6237407174a0c45c4af76fa7023853c3615177af;p=thirdparty%2Ftornado.git Document websocket error handling change (and StreamClosedError). --- diff --git a/docs/iostream.rst b/docs/iostream.rst index a2933a8f2..a5e3869e3 100644 --- a/docs/iostream.rst +++ b/docs/iostream.rst @@ -43,3 +43,8 @@ .. autoclass:: PipeIOStream :members: + + Exceptions + ---------- + + .. autoexception:: StreamClosedError diff --git a/docs/releases/next.rst b/docs/releases/next.rst index 05ea57d65..a8d384b91 100644 --- a/docs/releases/next.rst +++ b/docs/releases/next.rst @@ -229,6 +229,9 @@ Multiple modules `tornado.websocket` ~~~~~~~~~~~~~~~~~~~ +* `.WebSocketHandler` now catches `.StreamClosedError` and runs + `~.WebSocketHandler.on_close` immediately instead of logging a + stack trace. * New method `.WebSocketHandler.set_nodelay` can be used to set the ``TCP_NODELAY`` flag. diff --git a/tornado/iostream.py b/tornado/iostream.py index 9f9a1e60d..079012c9e 100644 --- a/tornado/iostream.py +++ b/tornado/iostream.py @@ -48,6 +48,12 @@ except ImportError: class StreamClosedError(IOError): + """Exception raised by `IOStream` methods when the stream is closed. + + Note that the close callback is scheduled to run *after* other + callbacks on the stream (to allow for buffered data to be processed), + so you may see this error before you see the close callback. + """ pass