patriksimek/connect-mssql

Can't throw error on db connect

Opened this issue · 1 comments

Can't throw error if i use a error password

var mssql_config = {
    user: 'test_dba',
    password: 'xxxxxx',
    server: 'xxx.xxx.xxx.xx', // You can use 'localhost\\instance' to connect to named instance
    database: 'ASPState'
}

var store = new MSSQLStore(mssql_config);

store.on('connect', function(err) {
    console.log(err);
});

store.on('error', function(err) {
    console.log(err);
});

app.use(session({
  store: store,
  secret: 'keyboard cat'
}))

The event error or connect can't output anything.

You should add catch on "this.connection.connect()" like this

this.connection.connect().then((function(_this) {
  return function() {
    if (_this.autoRemove === 'interval') {
      _this.destroyExpired();
      return setInterval(_this.destroyExpired.bind(_this), _this.autoRemoveInterval);
    }
  };
})(this)).catch(this.emit.bind(this, 'error'));

So please fix this bug ~

i want fix this, but i don't know how to resolve this in coffescript