code: function errorHandler(conn) {
    return function(err) {
      if (connectionAccounting) deleteConnection(conn.id);
      // Debug information
      if (conn.logger.isDebug()) {
        conn.logger.debug(
          `connection ${conn.id} for [${conn.address}] errored out with [${JSON.stringify(err)}]`
        );
      }
  
      conn.emit('error', new MongoNetworkError(err), conn);
    };
  }
docs: Connection handlers