Uncatchable errors in node.js

Posted by Peter Burns on Stack Overflow See other posts from Stack Overflow or by Peter Burns
Published on 2010-05-23T21:08:48Z Indexed on 2010/05/23 21:10 UTC
Read the original article Hit count: 270

So I'm trying to write a simple TCP socket server that broadcasts information to all connected clients. So when a user connects, they get added to the list of clients, and when the stream emits the close event, they get removed from the client list.

This works well, except that sometimes I'm sending a message just as a user disconnects.

I've tried wrapping stream.write() in a try/catch block, but no luck. It seems like the error is uncatchable.

© Stack Overflow or respective owner

Related posts about error-handling

Related posts about tcp