Skip to content

Commit

Permalink
Remove code that falls back to attempting to initialize session store…
Browse files Browse the repository at this point in the history
… w/ `express` (rather than `express-session`)

This code was there to support Express 3-compatible session adapters, and we don't have Express 3 anymore.
  • Loading branch information
sgress454 committed Nov 21, 2016
1 parent 92d4427 commit 628a55b
Showing 1 changed file with 19 additions and 27 deletions.
46 changes: 19 additions & 27 deletions lib/hooks/session/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,33 +219,25 @@ module.exports = function(app) {
try {
CustomStore = SessionAdapter(require('express-session'));
app.config.session.store = new CustomStore(app.config.session);
} catch (rawErr) {

This comment has been minimized.

Copy link
@mikermcneil

mikermcneil Dec 12, 2016

Member

this removal orphaned references to rawErr below -- fixed in 069ec2d

// If that fails, attempt to initialize the adapter using express
// (required by older session adapters)
try {
CustomStore = SessionAdapter(require('express'));
app.config.session.store = new CustomStore(app.config.session);
}
catch (unused) {

// Failed attempting to initialize adapter; output a message w/ error info
// TODO: negotiate error and give better error msg depending on code
return cb(new Error(
'Encountered error in the installed version of `' + app.config.session.adapter + '` (a session adapter).\n'+
'Raw error from the session adapter:\n'+
'---\n'+
(function _getAppropriateMessageFromRawSessionAdapterErr(){
if (_.isError(rawErr)) { return rawErr.stack; }
else if (_.isString(rawErr)) { return rawErr; }
else { return util.inspect(rawErr, { depth: null }); }
})()+'\n'+
'---\n'+
'\n'
));

}//</catch :: failed to instantiate session adapter by passing in express-session AND by passing express!>
}//</catch :: failed to instantiate session adapter by passing in express-session>

}
catch (unused) {

// Failed attempting to initialize adapter; output a message w/ error info
// TODO: negotiate error and give better error msg depending on code
return cb(new Error(
'Encountered error in the installed version of `' + app.config.session.adapter + '` (a session adapter).\n'+
'Raw error from the session adapter:\n'+
'---\n'+
(function _getAppropriateMessageFromRawSessionAdapterErr(){
if (_.isError(rawErr)) { return rawErr.stack; }
else if (_.isString(rawErr)) { return rawErr; }
else { return util.inspect(rawErr, { depth: null }); }
})()+'\n'+
'---\n'+
'\n'
));

} //</catch :: failed to instantiate session adapter by passing in express-session>
} catch(rawRequireErr) {

// If an error occurred while attempting to require() the adapter, include
Expand Down

0 comments on commit 628a55b

Please sign in to comment.