Skip to content

Commit

Permalink
Forward "failure to connect to Redis" error
Browse files Browse the repository at this point in the history
  • Loading branch information
sgress454 committed Jan 24, 2017
1 parent 3236b4e commit 32107b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions lib/hooks/session/index.js
Expand Up @@ -251,13 +251,15 @@ module.exports = function(app) {
Redis.getConnection({
manager: createManagerResult.manager,
meta: _.omit(app.config.session, ['host', 'port', 'password', 'database', 'url', 'adapter'])
}).exec(function(err, result) {
if (err) {return cb(err);}

// Save the connected client into the session config so that it can be used
// by the connect-redis module.
app.config.session.client = result.connection;
return afterMaybeConnectToRedis();
}).exec({
failed: function(err) { return cb(err.error); },
error: cb,
success: function(result) {
// Save the connected client into the session config so that it can be used
// by the connect-redis module.
app.config.session.client = result.connection;
return afterMaybeConnectToRedis();
}
});

});
Expand Down
2 changes: 1 addition & 1 deletion test/integration/middleware.session.redis.test.js
Expand Up @@ -55,7 +55,7 @@ if (process.env.TEST_REDIS_SESSION) {
}

}, function(err) {
if (err.code === 'E_REDIS_CONNECTION_FAILED') {
if (err && err.code === 'ECONNREFUSED') {
return done();
}
else if (err) {
Expand Down

0 comments on commit 32107b3

Please sign in to comment.