Skip to content

Commit

Permalink
better Error handling for disconnected issue
Browse files Browse the repository at this point in the history
  • Loading branch information
aheckmann committed May 25, 2011
1 parent 903065c commit 75bda1b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/mongodb/db.js
Expand Up @@ -332,7 +332,6 @@ Db.prototype.lastError = function(options, callback) {
// debug("============== error::" + inspect(error))
// debug("============== callback::" + inspect(callback))

if (err && !(err instanceof Error)) err = new Error(err);
callback(err, error && error.documents);
});
};
Expand Down Expand Up @@ -515,8 +514,9 @@ Db.prototype.executeCommand = function(db_command, read, callback) {
writer.send(db_command)
// self.serverConfig.primary.send(db_command);
} catch(err){
if(callback instanceof Function) {
delete self.notReplied[db_command.getRequestId().toString()];
if(!(err instanceof Error)) err = new Error(err);
if(callback instanceof Function) {
delete self.notReplied[db_command.getRequestId().toString()];
return callback(err, null);
}

Expand Down

0 comments on commit 75bda1b

Please sign in to comment.