Skip to content

Commit

Permalink
Merge pull request #64 from mdonnellyli/master
Browse files Browse the repository at this point in the history
Propagates the error message from Mongo to the Error object
  • Loading branch information
kcbanner committed May 22, 2013
2 parents 0d5df55 + 90cdfa8 commit 5951275
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/connect-mongo.js
Expand Up @@ -125,7 +125,7 @@ module.exports = function(connect) {
} else {
self.db.collection(self.db_collection_name, function(err, collection) {
if (err) {
throw new Error('Error getting collection: ' + self.db_collection_name);
throw new Error('Error getting collection: ' + self.db_collection_name + ' <' + err + '>');
} else {
self.collection = collection;

Expand All @@ -134,7 +134,7 @@ module.exports = function(connect) {
// mongo to remove anything expired without any additional delay.
self.collection.ensureIndex({expires: 1}, {expireAfterSeconds: 0}, function(err, result) {
if (err) {
throw new Error('Error setting TTL index on collection : ' + self.db_collection_name);
throw new Error('Error setting TTL index on collection : ' + self.db_collection_name + ' <' + err + '>');
}

callback && callback(self.collection);
Expand All @@ -150,7 +150,7 @@ module.exports = function(connect) {
else {
this.db.open(function(err, db) {
if (err) {
throw new Error('Error connecting to database');
throw new Error('Error connecting to database <' + err + '>');
}

if (options.username && options.password) {
Expand Down

0 comments on commit 5951275

Please sign in to comment.