Skip to content

Commit

Permalink
Emit error on connection error. Closes #149
Browse files Browse the repository at this point in the history
  • Loading branch information
sorribas committed Oct 5, 2014
1 parent d52e1ea commit e708924
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,10 @@ var connect = function(config, collections) {

var ondb = thunky(function(callback) {
mongodb.Db.connect(connectionString, function(err, db) {
if (err) return callback(err);
if (err) {
that.emit('error', err);
return callback(err);
}
that.client = db;
that.emit('ready');
db.on('error', function(err) {
Expand Down

0 comments on commit e708924

Please sign in to comment.