Skip to content

Commit

Permalink
issue/#632
Browse files Browse the repository at this point in the history
desc: replaced asyn with foreach and added logging on exception error
  • Loading branch information
finbartracey1 committed Apr 17, 2015
1 parent 535d090 commit 977465a
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,13 @@ Origin.prototype.createServer = function (options, cb) {
server.use(auth.session());
server.use(express.static(path.join(app.configuration.serverRoot, 'frontend', 'src')));
server.use(permissions.policyChecker());

// loop through the plugins for middleware
var pluginManager = pluginmanager.getManager();
var plugins = pluginManager.getPlugins();
var plugin;
async.forEach(Object.keys(plugins), function (directory, cbOuter){
async.forEach(Object.keys(plugins[directory]), function (name, cb){
Object.keys(plugins).forEach(function(directory){
Object.keys(plugins[directory]).forEach(function(name){
try {
var Plugin = require(plugins[directory][name].fullPath);
plugin = new Plugin();
Expand All @@ -301,18 +302,15 @@ Origin.prototype.createServer = function (options, cb) {
callback();
});
}
cb();
} catch (err) {
return cb(err);
logger.log('fatal', 'error getting plugin middleware', err);
}

}, function(err) {
cbOuter()
});
}, function(err) {
server.use(server.router);
server.use(app.clientErrorHandler());
});
});
});

server.use(server.router);
server.use(app.clientErrorHandler());

});

server.configure('development', function () {
Expand Down

0 comments on commit 977465a

Please sign in to comment.