adds error handlers to sockets