From 0a1fd22a00450efc96a1781c64276dc2724585e7 Mon Sep 17 00:00:00 2001 From: Aaron Heckmann Date: Fri, 16 Mar 2012 21:13:23 -0400 Subject: [PATCH] string is not an Error Conflicts: lib/mongodb/connection/repl_set_servers.js --- lib/mongodb/connection/repl_set_servers.js | 6 +++--- lib/mongodb/db.js | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/mongodb/connection/repl_set_servers.js b/lib/mongodb/connection/repl_set_servers.js index 1169227b05..aae175a972 100644 --- a/lib/mongodb/connection/repl_set_servers.js +++ b/lib/mongodb/connection/repl_set_servers.js @@ -294,8 +294,8 @@ var cleanupTags = ReplSetServers._cleanupTags = function(server, byTags) { var cleanInstances = []; // We got instances for the particular tag set var instances = byTags[serverTagKeys[i]][value]; - for(var j = 0; j < instances.length; j++) { - var serverInstance = instances[j]; + for(var j = 0, jlen = instances.length; j < jlen; j++) { + var serverInstance = instances[j]; // If we did not find an instance add it to the clean instances if((serverInstance.host + ":" + serverInstance.port) !== (server.host + ":" + server.port)) { cleanInstances.push(serverInstance); @@ -971,4 +971,4 @@ ReplSetServers.prototype.close = function(callback) { } } } -} \ No newline at end of file +} diff --git a/lib/mongodb/db.js b/lib/mongodb/db.js index cc820a02bc..920add9fb7 100644 --- a/lib/mongodb/db.js +++ b/lib/mongodb/db.js @@ -90,9 +90,11 @@ function Db(databaseName, serverConfig, options) { this.bson_serializer = bsonLib; } catch (err) { // If we tried to instantiate the native driver - throw "Native bson parser not compiled, please compile or avoid using native_parser=true"; + var msg = "Native bson parser not compiled, please compile " + + "or avoid using native_parser=true"; + throw Error(err); } - + // Internal state of the server this._state = 'disconnected';