Browse files

emit collection errors

things like strict mode will cause this to fail.
do not swallow them.
  • Loading branch information...
1 parent df98cf7 commit 956c2e7753db37848c08db68f90cbaf05e39ae7d @aheckmann aheckmann committed Feb 6, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/drivers/node-mongodb-native/collection.js
View
6 lib/drivers/node-mongodb-native/collection.js
@@ -32,8 +32,10 @@ MongooseCollection.prototype.__proto__ = Collection.prototype;
MongooseCollection.prototype.onOpen = function () {
var self = this;
this.conn.db.collection(this.name, function (err, collection) {
- // TODO handle err
- if (!err){
+ if (err) {
+ // likely a strict mode error
+ self.conn.emit('error', err);
+ } else {
self.collection = collection;
Collection.prototype.onOpen.call(self);
}

0 comments on commit 956c2e7

Please sign in to comment.