-Ben
Unfortunately we don't currently expose any information about the
error to the close callback. It would be nice to add this, but it
would have to be done in a backwards-compatible way. Maybe a flag to
set_close_callback to indicate whether the callback can accept an
error code?-Ben
If there were other changes to this callback signature in the future,
I don't think we'd want to have a bunch of boolean arguments to
set_close_callback to turn them on and off piecemeal (but then
something like callback_version=2 is also pretty ugly).
Maybe IOStream should just have an error attribute (like
tornado.httpclient.HTTPResponse) that contains the Exception that
caused the connection to be closed (if any). This would make the
cause of the failure accessible to the application without changing
the callback signature.
-Ben
There's more that can go wrong than just an errno, so we should
probably pass the Exception object (or maybe the whole exc_info
triple).If there were other changes to this callback signature in the future,
I don't think we'd want to have a bunch of boolean arguments to
set_close_callback to turn them on and off piecemeal (but then
something like callback_version=2 is also pretty ugly).Maybe IOStream should just have an error attribute (like
tornado.httpclient.HTTPResponse) that contains the Exception that
caused the connection to be closed (if any). This would make the
cause of the failure accessible to the application without changing
the callback signature.-Ben